项目配置
找到***vue.config.js***文件 在devServer中 添加 disableHostCheck: true,
devServer: {
disableHostCheck: true, }
去掉懒加载 // mode: “history”
const createRouter = () =>
new Router({
// mode: "history", // Disabled due to Github Pages doesn't support this, enable this if you need.
scrollBehavior: (to, from, savedPosition) => {
if (savedPosition) {
return savedPosition;
} else {
return { x: 0, y: 0 };
}
},
base: process.env.BASE_URL,
routes: constantRoutes
});