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
我的错在哪里?
答案 0 :(得分:0)
使用axios.post时添加默认标头:
import axios from 'axios';
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';