首先把content-type请求格式改成 application/x-www-form-urlencoded
headers: {'content-type': 'application/x-www-form-urlencoded'}
然后项目引入qs,安装:cnpm install qs,引入:import qs from ‘qs’
提交数据data
data:this.qs.stringify({name:this.name})
完整
this.$axios({
method: "POST",
url: urls,
headers: {'content-type': 'application/x-www-form-urlencoded'},
data:this.qs.stringify({
name:this.name
})
}).then(res => {
console.log(res)
}).cach(err=>{
console.log(err)
})