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

posted @ 2020-11-30 20:32  别惹星爷  阅读(1582)  评论(0编辑  收藏  举报