這篇文章主要介紹如何使用axios解決跨域cookie丟失的問(wèn)題,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
設(shè)置 axios.defaults.withCredentials = true 即可
示例代碼:
axios.defaults.withCredentials = true; var param = new URLSearchParams(); param.append("vCode",vcode); axios.post('http://localhost',param) .then(function(res) { var rs=res.data; console.log(rs.data); }) .catch(function(err) { console.log(err); });
以上是“如何使用axios解決跨域cookie丟失的問(wèn)題”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!