1.0.4 • Published 4 years ago

digi-router v1.0.4

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

Build Status codecov

digi-router

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页面放在最后'
  }
])