vue.js怎么把表单提交到data里
1 回答
郎朗坤
TA贡献1921条经验 获得超9个赞
vue.js把表单提交到data里:
axios({
url: '/user',
method: 'post',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
},
transformRequest: [function (data) {
// Do whatever you want to transform the data
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
添加回答
举报
0/150
提交
取消