在vue.config.js 加上 historyApiFallback: true,具体位置如下:
module.exports = {
publicPath: './',
devServer: {
historyApiFallback: true,//这里这里
port: 9966,
proxy: {
'/api': {
target: 'http://127.0.0.1:9977',
changeOrigin: true, /
pathRewrite: {
'^/api': ''
}
}
}
}
}