Package Exports
- kuririn-react-router
- kuririn-react-router/dist/es/index.js
- kuririn-react-router/dist/lib/index.cjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (kuririn-react-router) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Welcome to kuririn-react-router
English | 简体中文
Kuririn repeat router is a routing library for H5 that can simulate the effect of page stacks in apps (or mini programs), achieve page push, back, and replace, and support browser forward and backward buttons
Demo
In the example, index is the first level page, detail1 is the second level page, and detail2 is the third level page
KRoutes
Props
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| historyType | 'hash' | 'browser' |
'browser' | |
| pages | All pages | IPageItem[] |
- |
| page404 | Can pass in 404 page component | - |
export interface IPageItem {
path: string
component: IPageItemComponent
isTab?: boolean
}Entry file App.tsx
import { KRoutes } from 'kuririn-react-router'
import PageIndex from '@/pages/index/index'
import PageDetail1 from '@/pages/detail1/index'
import PageDetail2 from '@/pages/detail2/index'
function App() {
return (
<KRoutes
pages={[
{ path: '/', component: PageIndex },
{ path: '/detail1', component: PageDetail1 },
{ path: '/detail2', component: PageDetail2 },
]}
/>
)
}Router
import { router } from 'kuririn-react-router'
router.push
router.push('/detail1')router.back
router.back()
router.back(-1)router.replace
router.replace('/detail2')router.switchTab
router.switchTab('/')
router.switchTab('/wode')Remark
This package depends on React, mobx, and mobx-react, so please ensure that these packages are already installed in your project