mp_canvas_drawer
mp_canvas_drawer copied to clipboard
改造成uni-app版本的小程序使用
你好,我把这个改造成uni-app版本的,绘图成功了,但是会报Cannot read property 'xiaoying' of null,
saveImageToLocal () { const width = this.width; const height = this.height; wx.canvasToTempFilePath({ x: 0, y: 0, width, height, canvasId: 'canvasdrawer', complete: res => { if (res.errMsg === 'canvasToTempFilePath:ok') {
// 有这三行代码会报错:Cannot read property 'xiaoying' of null
this.showCanvas = false;
this.isPainting = false;
this.tempFileList = [];
// 有这三行代码会报错:Cannot read property 'xiaoying' of null
this.$emit('getImage', {tempFilePath: res.tempFilePath, errMsg: 'canvasdrawer:ok'})
} else {
this.$emit('getImage', {errMsg: 'canvasdrawer:fail'})
}
}
}, this)
}
老哥。咋解决的啊。我马上也要在uni-app里用这个。
老哥。咋解决的啊。我马上也要在uni-app里用这个。
除了配置白名单,和图片地址必须是https格式外,我稍微改造了下代码, 搬砖,照着大佬代码改做了一个uni-app版本的 https://github.com/zibuyu1/uni-app-weixin
感谢老哥。🙏🙏🙏
推荐这个canvas库 easy-canvas