在main.js中找到这段代码
const createRouter = () => new Router({
mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})
加上
base: 'web', //页面路由前缀
修改后代码:
const createRouter = () => new Router({
mode: 'history', // require service support
base: 'web',
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})
现在你的每个页面都会有一个【web】前缀了