返回顶部

vue——put请求设置header后无效问题解决

原:

···
let config = { headers: { "Content-Type": "application/json", "token": localStorage.getItem("token") } } this.$axios.put('***' ,config).then(function (res) { ··· })
···

 

改:

···
let config = {
    headers: {
          "Content-Type": "application/json",
          "token": localStorage.getItem("token")
    }
}

this.$axios.put('***' ,'',config).then(function (res) {  // <= 关键,在url和config中插入一个空字符参数
    ···
})
···

 

posted @ 2020-05-20 17:35  前端-xyq  阅读(2224)  评论(0)    收藏  举报