詳細問題描述
寫圖片裁切組件,發現canvas的draw()方法無法進入回調,用了uniapp官方例子里的圖片裁切在nvue
頁面,也是不行,加了定時也不行
uni-app運行環境說明
app端的nvue頁面
targetContext.drawImage(this.url, x, y, width, height, 0, 0, tw, th); targetContext.draw(false, () => { uni.canvasToTempFilePath({ canvasId: "target", success: (res) => { var path = res.tempFilePath; // #ifdef H5 if (this.blob) { path = this.parseBlob(path); } // #endif const data = { head_img:this.url } this.$emit('updateHeadImg',data) }, fail: (ev) => { console.log(ev); }, complete: () => { uni.hideLoading(); } }, this); });
·回復
是 gcanvas ?
·回復
nvue 頁面 引入 vue 頁面,會把 vue 頁面當作 nvue 處理,nvue 目前不支持直接使用canvas
參考文檔底部 如何在 nvue 中使用 canvas https://uniapp.dcloud.io/component/canvas