axios传递x-www-form-urlencoded数据

平时都用axios传递json数据,如何传递非json数据

let data = new URLSearchParams()
data.append('accountName',xxxx)
data.append('accountType','XXXX')
data.append('password',xxxxx)
data.append('verifyType',x)

this.$axios.post('/api/account_login.rm',data,{headers: {'Accept':'*/*','Content-Type': 'application/x-www-form-urlencoded'}}).then(function (res) {
console.log(res)
}).catch(function (error) {
console.log(error)
})

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: