vue 請求報錯 Uncaught (in promise) 的解決方法


如果promise中 reject的錯誤沒有被捕獲到就會報這個錯誤

 getImage: function (url) {
        return new Promise((resolve, reject) => {
          wx.getImageInfo({
            src: url,
            success: function (res) {
              resolve(res)
            },
            fail: function () {
              reject("")
            }
          })
        }).catch((e) => {
console.log(e)
});
      },
  // 獲取溢價列表
      premiumsData(data) {       
        getPremiums(data).then(res => {
          if (res.data.data.length > 0) {
            this.data= res.data.data;
          }
        }).catch(err=>{
console.log(err)
        });
      },

只要在后面加上.catch((e) => {}),就不會報錯了,

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 vue報錯 Uncaught (in promise) NavigationDuplicated {_name:""NavigationDuplicated"... 的解決方法 vue-router報錯Uncaught (in promise)及解決方法 VUE.js項目中控制台報錯: Uncaught (in promise) NavigationDuplicated解決方法 Vue. 之 報錯 Uncaught (in promise) Vue報錯:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#‘的解決方法 Vue報錯:Uncaught TypeError: Cannot assign to read only property 'exports' of object 的解決方法 VUE中頁面F5刷新空白並報錯報錯:Uncaught SyntaxError: Unexpected token <解決方法 jQuery報錯:Uncaught ReferenceError: $ is not defined解決方法 【vue】---- ElementUI 中的$confirm 彈窗報錯 Uncaught (in promise) cancel Async 方法中報Uncaught (in promise)解決方案
 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM