uniapp canvas 安卓真機不顯示draw


詳細問題描述

寫圖片裁切組件,發現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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM