Taro报错集锦

1、使用异步报错

 

    错误:VM12791:1 thirdScriptError sdk uncaught third Error regeneratorRuntime is not defined

            ReferenceError: regeneratorRuntime is not defined

    解决:

         安装包 @tarojs/async-await

         npm install --save @tarojs/async-await

     随后在项目入口文件 app.js 中直接 import ,就可以开始使用 async functions 功能了

        // src/app.js

 

       import '@tarojs/async-await'

 

 

2、小程序画布相关

     错误:canvasToTempFilePath: fail canvas is empty

     解决:  添加用户授权 ,    this.$scope

 

 

wx.canvasToTempFilePath({
canvasId: canvasId,
x: 0,
y: 0,
width: imageW,
height: imageH,
quality: 1,
success(res) {
console.log("success")
getImgsuccess(res.tempFilePath);
},
fail(errMsg){
console.log("fail",errMsg)
},
},this.$scope); //添加用户授权
posted @ 2021-03-02 19:58  似是故人来~  阅读(664)  评论(0编辑  收藏  举报