你能帮帮我吗?我有一个带有主体参数的POST方法,在var product_ids中有两个值
BODY
product_ids = 8|559
customer_type_id = 2
qty_from = 11
sell_price = 10001
这是我的axios代码
createNewPricetiers() {
this.loading = true
let headers = {
Authorization: 'Bearer ' + window.accessToken
}
let data = {
product_ids: this.$route.params.id || this.form.variant,
customer_type_id: this.form.customer,
qty_from: this.form.qty,
sell_price: this.form.sellPrice
}
axios({
method: 'POST',
url: BASE_API + 'productpricetiers',
headers: headers,
data: data
})
...
但是当它调用服务器时,多个参数不能运行,只是发送参数this.$route.params.id
,哪里是我的错?
发布于 2018-05-28 13:31:47
使用axios.post时添加默认标头:
import axios from 'axios';
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
https://stackoverflow.com/questions/50558856
复制相似问题