vue 使用$http 请求接口 路径多了1个文件
需要请求/testwx/RoomType/add 路径一直报错/roomType//testwx/RoomType/add
之前是这样的写法
this.$http.post('testwx/RoomType/add', this.roomInfo).then(response => {
if (response.data) {
this.$message({
message: '提交成功!',
type: 'success'
})
this.loading = false
setTimeout(this.onCancel(), 20000)
} else {
this.showError()
this.loading = false
}
})
后来改成了/testwx/RoomType/add 多了1个/
在vue.config.js里配置了跨域
'/testwx/': {
target: 'http://127.0.0.1:3000',
changeOrigin: true,
ws: true,
pathRewrite: {
"^/testwx": '/'
}
}
浙公网安备 33010602011771号