今天小编就为大家分享一篇VUE 解决mode为history页面为空白的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
当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:'<mark>来源gaodaimacom搞#^代%!码网</mark>/public/'
对应的路径 index:’/public/index.html’
重启webpack,刷新页面就好了
以上就是VUE 解决mode为history页面为空白的问题的详细内容,更多请关注gaodaima搞代码网其它相关文章!