var form={
"sl": "en",
"tl": "zh-CN",
"p": "1",
"q": "A test text."
}
axios({
method: 'post',
url: 'http://www.tastemylife.com/gtr.php',
data: form,
headers: {
'content-type': 'application/x-www-form-urlencoded'
},
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
}],
})
.then(function (res) {
_this.title[Object.keys(_this.title)[1]] = res.result
return resolve(res);
})
.catch(function (err) {
console.log(err);
})
或者jQuery param() 方法