今天用vue-cli3.0创建了一个单页项目,本地跑的还没有上线部署,有个问题,当跳转到别一个页面之后 刷新浏览器会找不到路由 报404 目前所有的.vue文件都放在views里面该怎么配置呢我的vue.config.js配置文件const path = require('path')function resolve (dir) {return path.join(__dirname,dir)}module.exports = {lintOnSave: false,//assetsDir: 'battleDuty',devServer: {
open: true,
proxy: { '/api': {
target: 'http://22.123.321/',
ws: true,
changeOrigin: true
},
}, // 配置
historyApiFallback: {
rewrites: [{ from: /./,
to: '/public/index.html'
}]
}
},
configureWebpack: config => {
config.resolve = {
extensions: ['.js', '.vue', '.json',".css"],
alias: { 'vue$': 'vue/dist/vue.esm.js', '@': resolve('src'),
}
}
},}
添加回答
举报
0/150
提交
取消