You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
671 B

import Vue from 'vue'
import Router from 'vue-router'
// 导入刚才编写的组件
import AppIndex from '../components/home/AppIndex'
import Login from '../components/Login'
Vue.use(Router)
export default new Router({
mode: 'history',
routes: [
// 下面都是固定的写法
{
path: '/login',
name: 'Login',
component: Login
},
{
path: '/',
name: '/',
redirect: '/login'
},
{
path: '/index',
name: 'AppIndex',
component: AppIndex,
meta: {
// 在需要拦截的路由中加一条元数据,设置一个 requireAuth 字段
requireAuth: true
}
}
]
})