關于繪圖小程序問題:在微信開發者工具提供的模擬器上可以正常運行微信小程序canvas圖片微信小程序canvas圖片,但在PC端和手機端真機調試運行報錯,哪位大牛幫忙看一下是什么原因,該如何解決
index.wxml關鍵點代碼:
<canvas?id="canvas_preview"?type="2d"?mode="aspectFit"?background-size="cover"?style="vertical-align:middle;?width:600px;?height:600px">canvas>
???index.js關鍵代碼:(參考小程序開發文檔示例代碼)
wx.createSelectorQuery().select('#canvas_preview').fields({?id:?true,?node:?true,?size:?true?})
????????????.exec((res)?=>?{
??????????????????????var canvas?=?res[0].node
??????????????????????var ctx?=?canvas.getContext('2d')

......
})
真機運行報錯信息如下:
read '' of null
: read '' of null
at .eval (weapp:///pages/index/index.js:239:38)
at r.eval (eval at n.call. (:60808/-debug/.js?=true:1:14919), :2:)
at
at eval (eval at n.call. (:60808/-debug/.js?=true:1:14919), :2:)
at eval (eval at n.call. (:60808/-debug/.js?=true:1:14919), :2:)
at Array. ()
at eval (eval at n.call. (:60808/-debug/.js?=true:1:14919), :2:)
at eval (eval at n.call. (:60808/-debug/.js?=true:1:14919), :2:)
at eval (eval at n.call. (:60808/-debug/.js?=true:1:14919), :2:)
at A (eval at n.call. (:60808/-debug/.js?=true:1:14919), :2:)