后台服务器名 http://47.92.100.92:9002,配置 proxyTable:
proxyTable: {
'/api':{
target: 'http://47.92.100.92:9002/',
changeOrigin: true,
pathRewrite: {
'^api': '/api'
}
}
},
在组件login中拿数据的时候
methods: {
Sign() {
axios.post("/api/login", qs.stringify({
username: that.loginInfo.username,
password: that.loginInfo.userpass
}),{
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Accept":"application/json"
}
}).then((response) => {
//数据 success
// this.myData = res.data.info
Indicator.close();
console.log(response)
}, (error) => {
// error
Indicator.close();
console.log(error)
});
}
}
当点击Sign的时候浏览器报错
node报错
Your application is running here: http://localhost:8080 [HPM] Error occurred while trying to proxy request /api/login from localhost:8080 to http://47.92.100.92:9002/ (ECONNREFUSED) (/api/errors…