为什么使用Promise时编译报错?
发布于 3 年前 作者 xyu 3619 次浏览 来自 问答

module.exports={

  req : (url,data,method)=>{

    return new Promise((resolve,reject) =>{

      wx.request({

         url,

        data,

        method,

        success:function(res){

          resolve(res.data)

        },

        fail:function(e){

          reject(e)

        }

      })

    })

  }

}

报错信息,frames’是开发工具编译后的错误,代码里没有’frames’,编译的时候工具自己加上去的

TypeError: Cannot read property ‘frames’ of undefined

    at evaluateRes (VM508 asdebug.js:1)

    at Object.invoke (VM508 asdebug.js:1)

    at Object.invoke (VM510 WAService.js:2)

    at o (VM510 WAService.js:2)

    at VM510 WAService.js:2

    at E (VM510 WAService.js:2)

    at VM510 WAService.js:2

    at v (VM510 WAService.js:2)

    at VM510 WAService.js:2

    at Array.forEach (<anonymous>)(env: Windows,mp,1.05.2104152; lib: 2.16.0)

回到顶部