skywalker2020
skywalker2020
  • 发布:2020-09-22 11:06
  • 更新:2020-12-23 09:43
  • 阅读:2210

【报Bug】uni.createCanvasContext(canvasId, this)调用出错

分类:HBuilderX

产品分类: HbuilderX

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: window10 专业版

HBuilderX版本号: 2.8.11

示例代码:
showCanvas(qrcode){  
    this.isShow = true  
    this.qrcode = qrcode  
    this.__init()  
},  
//初始化画布  
async __init(){  
     uni.showLoading({  
         title: '加载中...',  
         mask: true  
    })  
    this.ctx = uni.createCanvasContext('my-canvas',this)      
    ...  
}

操作步骤:

调用showCanvas,就会出现上述bug

预期结果:

海报分享功能正常, uni.createCanvasContext(canvasId, this)能调用

实际结果:

uni.createCanvasContext(canvasId, this)调用出错

bug描述:

在HBuilderX开发微信小程序,用到这个方法来处理海报分享功能。原来是没有任何问题的,过一段时间后突然发现这个功能不能用了,最后调查发现uni.createCanvasContext(canvasId, this)调用出错。具体错误如下:
VM377:1 [Vue warn]: Property or method "toJSON" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

(found in pages/detail/detail.vue)
_callee$ @ zhangyu-qrcode-poster.js:159
asyncGeneratorStep @ zhangyu-qrcode-poster.js:123
(anonymous) @ zhangyu-qrcode-poster.js:123
(anonymous) @ zhangyu-qrcode-poster.js:123
init @ zhangyu-qrcode-poster.js:154
showCanvas @ zhangyu-qrcode-poster.js:151
Show 61 more frames
VM377:1 (in promise) MiniProgramError
Converting circular structure to JSON
--> starting at object with constructor 'Object'
--- property '_renderProxy' closes the circle
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
--- property '_renderProxy' closes the circle
at JSON.stringify (<anonymous>)
at Object.sync (http://127.0.0.1:32286/appservice/
dev/asdebug.js:1:59384)
at Object.u [as beforeinvoke] (http://127.0.0.1:32286/appservice/
dev__/asdebug.js:1:27949)
at Proxy.value (http://127.0.0.1:32286/appservice/appservice?t=1600742625621:1:2765)
at _callee$ (http://127.0.0.1:32286/appservice/components/zhangyu-qrcode-poster.js:203:39)
at tryCatch (http://127.0.0.1:32286/appservice/common/vendor.js:2260:44)
at Generator.invoke [as _invoke] (http://127.0.0.1:32286/appservice/common/vendor.js:2471:26)
at Generator.prototype.<computed> [as next] (http://127.0.0.1:32286/appservice/common/vendor.js:2308:25)
at asyncGeneratorStep (http://127.0.0.1:32286/appservice/components/zhangyu-qrcode-poster.js:147:30)
at _next (http://127.0.0.1:32286/appservice/components/zhangyu-qrcode-poster.js:160:15)

2020-09-22 11:06 负责人:无 分享
已邀请:
skywalker2020

skywalker2020 (作者)

应该是小程序开发工具的问题,可以直接关掉了

skywalker2020

skywalker2020 (作者)

VM377:1 [Vue warn]: Property or method "toJSON" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See:

at _callee$ (http://127.0.0.1:32286/appservice/components/zhangyu-qrcode-poster.js:203:39

调用uni.createCanvasContext(canvasId, this)出现

这个问题依然存在,但是不影响功能了

chenli

chenli

微信开发者工具版本多少,升级到最新的应该就不会了。

skywalker2020

skywalker2020 (作者)

这个Vue warn的 问题在最新版还是存在, 版本号1.03.2009140

梦尋Junjie

梦尋Junjie - 原来她有男朋友

我的也是

该问题目前已经被锁定, 无法添加新回复