Skip to content

Pettarn/f-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

演示

f-router

npm version

f-router is a router for Vue.js

Feature

  • support router children
  • router redirect
  • router-link tag
  • router-view tag

todo

  • make the npm package smaller
  • need not to reload after change the location hash value to refresh the view
  • router hooks

Install

npm install @pettarn/f-router

Quick Start

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

App.vue

<template>
<div id="app">
    <h3>Following is router render component.</h3>
    <router-view></router-view>
</div>
</template>

router-link tag

<router-link to="/sex/a" tag="span">男</router-link>
or
<router-link to="/sex/b" tag="span">女</router-link>

About

A front-end router

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published