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…)
评论前必须登录!
注册