Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/digi1874/digi-router
digi路由
https://github.com/digi1874/digi-router
Last synced: 5 days ago
JSON representation
digi路由
- Host: GitHub
- URL: https://github.com/digi1874/digi-router
- Owner: digi1874
- License: mit
- Created: 2019-01-10T02:27:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T14:29:33.000Z (about 2 years ago)
- Last Synced: 2025-01-16T23:47:36.560Z (26 days ago)
- Language: JavaScript
- Homepage: https://digi1874.github.io/digi-router/docs/digi-router/1.0.1/index.html
- Size: 1.47 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/digi1874/digi-router.svg?branch=master)](https://travis-ci.org/digi1874/digi-router)
[![codecov](https://codecov.io/gh/digi1874/digi-router/branch/master/graph/badge.svg)](https://codecov.io/gh/digi1874/digi-router)# digi-router
### [digi](https://github.com/digi1874/digi)
## 使用
```
yarn add -D digi digi-router
```### 简单例子
```
import digi from 'digi'
import router from 'digi-router'digi.plugins([ ...router ])
digi([
{ to: '/', text: '首页' },
{ to: '/list', text: '列表页' },
{
path: '/',
child: { text: '首页内容' }
},
{
path: '/list'
child: [
{ to: '/list/1', text: '详情页1' },
{ to: '/list/2', text: '详情页2' }
]
},
{
path: { pathname: '/list/:id', watch: ({ params }) => console.log(params) // => { id: 1 } },
text: '详情页内容'
},
{
path: /.+/,
text: '404页面放在最后'
}
])```