axios跨域
错误
Local与Network一直一样,都是localhost(域名)
只能在本地访问
只能用域名访问
正确的显示
解决方式:
host的问题,将host改成’0.0.0.0’就可以了😱
module.exports = {
transpileDependencies: true,
outputDir: 'dist', //build输出目录
assetsDir: 'assets', //静态资源目录(js, css, img)
lintOnSave: false, //是否开启eslint
devServer: {
open: false, //是否自动弹出浏览器页面
// host: "<本机域名>",
host:'0.0.0.0',
// host: "localhost",
port: '8080',
https: false, //是否使用https协议
// hotOnly: false, //是否开启热更新
proxy: {
'/api': {
target: 'http://<本机域名>:8090', //API服务器的地址
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
},
}
}