Content-Type': 'application/x-www-form-urlencoded 接口传递参数的格式

后台接口要求headers={'Content-Type': 'application/x-www-form-urlencoded'}这种格式时,我们也需要用formData去传递参数

let formData = new FormData();
formData.append('content',JSON.stringify(content));
formData.append('id',this.editId);
this.$axios({
url:xxxxx,
method:'post',
data:formData
}).then(res=>{
if(res.data.success){

}
})
posted @ 2020-08-19 13:09  程序媛小仙女  阅读(4264)  评论(0编辑  收藏  举报