1,话不多说,直接代码
根目录创建vue.config.js
module.exports = {
devServer: {
port: 3000, // 端口
proxy: {
'/api': {
target: 'http://192.168.9.217:8999/',
changeOrigin: true,
ws: true,
pathRewrite: {
'^/api': ''
}
}
}
},
// lintOnSave: false // 取消 eslint 验证
}
axios post传参问题
methods:{
getParent(){
console.log(this.input);
const params = new URLSearchParams();
params.append('name', this.input);
params.append('password', this.input1);
this.$axios.post('api/user/login',params)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
}
},