f-router
is a router for Vue.js
- support router children
- router redirect
- router-link tag
- router-view tag
- make the npm package smaller
- need not to reload after change the location hash value to refresh the view
- router hooks
npm install @pettarn/f-router
import Vue from 'vue'
import FRouter from '@pettarn/f-router'
import indexPage from '../components/indexPage.vue'
import male from '../components/male.vue'
import female from '../components/female.vue'
Vue.use(FRouter)
let routes = [
{
path: '',
redirect: '/sex/'
},
{
path: '/sex/',
component: indexPage,
children: [
{
path: 'a',
component: male
},
{
path: 'b',
component: female
}
]
},
]
let router = new FRouter({
routes
})
export default router
<template>
<div id="app">
<h3>Following is router render component.</h3>
<router-view></router-view>
</div>
</template>
<router-link to="/sex/a" tag="span">男</router-link>
or
<router-link to="/sex/b" tag="span">女</router-link>