发现vue-cli脚手架新出了个3.0里面有多页配置项,对文档来试着配置,可以访问每个页面,但是发现刷新时,对应页面的路由都找不到,代码如下//vue.config.jsmodule.exports={baseUrl:process.env.NODE_ENV==='production'?'/ems/':'/ems/',pages:{admin:{entry:'src/views/admin/main.js',template:'public/admin.html',filename:'admin/index.html',},school:{entry:'src/views/school/main.js',template:'public/school.html',filename:'school/index.html',}}}//admin.routes.jsimportVuefrom'vue'importRouterfrom'vue-router'importHomefrom'@/views/admin/Home.vue'importLayoutfrom'@/components/layout-admin'Vue.use(Router)constroutes=[{path:'/',redirect:{name:'admin'},},{path:'/admin',name:'admin',component:Layout,redirect:{name:'home'},children:[{path:'home',name:'home',component:Home},{path:'about',name:'about',component:()=>import('./../views/admin/About.vue')}]}]exportdefaultnewRouter({mode:'history',base:process.env.BASE_URL,routes})当通过访问/ems/admin路由来访问/ems/admin/home是可以的,但是直接访问/ems/admin/home是访问不到的,有哪位指导下为啥?
添加回答
举报
0/150
提交
取消