分享你我的心得.
共乘一片美好网络.

小程序生成二维码出现错误TypeError: Cannot read property '_src' of undefined

MiniProgramError

Cannot read property ‘_src’ of undefined

TypeError: Cannot read property ‘_src’ of undefined

at bl.<computed>.e.useHardwareAccelerate [as drawImage] (eval at n.call.document (http://127.0.0.1:14008/remote-debug/runtime.js?devtools_ignore=true:1:14919), <anonymous>:2:1097717)

at bl.r.<computed> [as drawImage] (eval at n.call.document (http://127.0.0.1:14008/remote-debug/runtime.js?devtools_ignore=true:1:14919), <anonymous>:2:1125864)

at eval (weapp:///pages/ptIndex/ptIndex.js:654:21)

at success (weapp:///utils/base64src.js:31:7)

at eu (eval at n.call.document (http://127.0.0.1:14008/remote-debug/runtime.js?devtools_ignore=true:1:14919), <anonymous>:2:1123943)

at a.success (eval at n.call.document (http://127.0.0.1:14008/remote-debug/runtime.js?devtools_ignore=true:1:14919), <anonymous>:2:1126088)

at <api writeFile success callback function>

at Object.eval [as success] (eval at n.call.document (http://127.0.0.1:14008/remote-debug/runtime.js?devtools_ignore=true:1:14919), <anonymous>:2:113735)

at a (eval at n.call.document (http://127.0.0.1:14008/remote-debug/runtime.js?devtools_ignore=true:1:14919), <anonymous>:2:939697)

at eval (eval at n.call.document (http://127.0.0.1:14008/remote-debug/runtime.js?devtools_ignore=true:1:14919), <anonymous>:2:939880)

 

类似这样的错误下面是解决办法,做个判断

drawImage()方法的src可能为undefined,在调用drawImage()前做一层判断试试。

imageUrl && ctx.drawImage(imageUrl…)

赞(0)
未经允许不得转载:小叶白龙博客 » 小程序生成二维码出现错误TypeError: Cannot read property '_src' of undefined
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址