文件资源路径是对的,但是页面空白。百度了很久找了一篇文章解决了。
1.vue项目中config文件下index.js中打包配置
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/dist/',//history
2.路由配置:router文件夹下index.js
let router = new Router({
mode: 'history',//history
base: '/dist/',//history,
router:[{...}]
})
原文: https://blog.csdn.net/mjlfto/article/details/80270620