报错
原因
打包之后指向的地址不对。
解决方法
打包后的展示路径,要根据不同环境修改。
module.exports = {
publicPath:"./" //基础路径
publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
}
history模式改成hash模式
new Router({
mode:'hash'
})
打包之后指向的地址不对。
打包后的展示路径,要根据不同环境修改。
module.exports = {
publicPath:"./" //基础路径
publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
}
history模式改成hash模式
new Router({
mode:'hash'
})