import axios from 'axios'
import Qs from 'qs'
axios({
url: '',
method: 'post',
data: {
name: 'name',
age: 'age',
infos: [
{ value: 'value1', label: 'label1' },
{ value: 'value1', label: 'label2' }
]
},
transformRequest: [function(data) {
return Qs.stringify(data) // 使用Qs将请求参数序列化
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded' // 必须设置传输方式
}
})
axios 前端传递复杂参数
最新推荐文章于 2024-05-07 22:08:11 发布