axios请求报Uncaught (in promise) Error: Request failed with status code 404
生活随笔
收集整理的這篇文章主要介紹了
axios请求报Uncaught (in promise) Error: Request failed with status code 404
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
使用axios處理請求時,出現的問題解決
當url是遠程接口鏈接時,會報404的錯誤:
Uncaught (in promise) Error: Request failed with status code 404解決方法:
var instance = axios.create({ headers: {'content-type': 'application/x-www-form-urlencoded'} }); instance.post(`url`, params).then(res => res.data);后臺接收不到傳入參數解決方法:
var qs=require('qs'); var instance = axios.create({ headers: {'content-type': 'application/x-www-form-urlencoded'} }); instance.post(`url`, qs.stringify(params)).then(res => res.data);
轉載于:https://www.cnblogs.com/nicest/p/9599089.html
總結
以上是生活随笔為你收集整理的axios请求报Uncaught (in promise) Error: Request failed with status code 404的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 系统重装助手教你如何在Microsoft
- 下一篇: spring boot(一)入门