Vue.js Vue Cli 3.x |获取CORS错误和代理似乎没有帮助
我将devServer配置设置为:Vue.js Vue Cli 3.x |获取CORS错误和代理似乎没有帮助,vue.js,axios,vue-cli,vue-cli-3,Vue.js,Axios,Vue Cli,Vue Cli 3,我将devServer配置设置为: devServer: { port: 8888, host: "0.0.0.0", proxy: { '/api': { target: 'http://180.76.249.27:80/weibo/', ws: true, changeOrigin: true, pathRewrite: {
devServer: {
port: 8888,
host: "0.0.0.0",
proxy: {
'/api': {
target: 'http://180.76.249.27:80/weibo/',
ws: true,
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
},
}
async loadShowList() {
let { data } = await axios.$get(
"http://121.46.19.26:8288/getWeibo/" + this.query
);
this.showList = data;
}
我使用axios的方式如下:
devServer: {
port: 8888,
host: "0.0.0.0",
proxy: {
'/api': {
target: 'http://180.76.249.27:80/weibo/',
ws: true,
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
},
}
async loadShowList() {
let { data } = await axios.$get(
"http://121.46.19.26:8288/getWeibo/" + this.query
);
this.showList = data;
}
但我总是犯同样的错误
我想知道这是否与我的axios配置有关
你知道吗?Axios调用哪个api?是nodejsapi吗?