打包出来的文件,css都能用,就是static里面的json文件404,已经照着网上修改了一次,还是没法显示。
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
我是这样引用本地 json文件的:
mounted: function () {
axios.get('static/data/dataBase.json')
.then((res) => {
console.log(res)
this.news = res.data.dataTxt
})
.catch((err) => {
console.log(err)
})
},
把
改成
试试