首先在router文件夹中的index文件先写固定路由(首页,404,登陆页面等),然后在router文件夹下创建page文件,此文件放入动态路由(运营管理,商品管理,推广管理等)
index文件
{
path: '/index',
name: 'IndexView',//主页面
component: () => import('../views/Index.vue')
}
,{
path: '/login',//登录页面
name: 'LoginView',
component: () => import('../views/Login.vue')
},
{
path: '/404',//404
name: '404',
component: () => import('../views/404.vue')
},
{
path: "/:pathMatch(.*)*",
name: 'NotFoundView',
redirect: "/404" //路由重定向
}
page文件