1、注:
hash模式打包能直接打开
history模式需要结合后端配置
2、vue.config.js配置
module.exports = {
publicPath: "/qyqjd/"
}
3、router配置
new Router({
mode: "history",
base: '/qyqjd',
scrollBehavior: () => ({ y: 0 }),
routes: [...constantRoutes, ...asyncRoutes],
});