VUE 解决mode为history页面为空白的问题
时间:2021-07-09 08:25:59|栏目:vue|点击: 次
当router.js 中mode:history 发现刷新页面 不显示了,原因出来history的请求路径资源不存在了,这个需要后端配置的,
前端 需要修改一个地方即可,
devServer: {
port: 8000,
host: '0.0.0.0',
overlay: {
errors: true
},
hot: true,
historyApiFallback: {
index: '/index.html'
}
},
新增historyApiFallback这个个功能,然后的index的路径需要配置output输出的Publicpath的配合使用
publicPath:'/public/'
对应的路径 index:'/public/index.html'
重启webpack,刷新页面就好了
栏 目:vue
下一篇:详解vue-router的Import异步加载模块问题的解决方案
本文标题:VUE 解决mode为history页面为空白的问题
本文地址:http://www.codeinn.net/misctech/154659.html






