路由
封装了页面路由,使客户端和服务器复用相同的路由配置。
在 src/router/index.js
文件下配置路由
export default store => {
return new Router({
mode: 'history',
scrollBehavior(to, from, savedPosition) {
return { x: 0, y: 0 }
},
routes: [
{
path: '/login',
component: () => import('@/pages/login/index'),
hidden: true
},
{
path: '/404',
component: () => import('@/pages/404'),
hidden: true
},
{
path: '/',
component: Layout,
redirect: '/home',
children: [
{
path: 'home',
name: 'home',
component: () => import('@/pages/home/index'),
meta: { title: 'home', icon: 'home' }
}
]
}
]
}