canvasToTempFilePath: fail canvas is empty
如果是子组件内部创建的上下文uni.createCanvasContext(‘myCanvas’, this);,则生成图片需要加个this指向当前子组件uni.canvasToTempFilePath(callback, this)
canvasToTempFilePath模糊处理
获取设备像素比,然后canvas宽高和真实宽高都乘以设备像素比即可
uni.canvasToTempFilePath({
canvasId: 'myCanvas',
height: height * dp,
width: width * dp,
destHeight: height * dp,
destWidth: width * dp,
success: res => {}
})
本文介绍了在子组件中使用uni框架的canvasToTempFilePath方法时,如何处理设备像素比以实现清晰的图片转换,以及在调用该函数时确保正确的this指向和尺寸调整。
4338

被折叠的 条评论
为什么被折叠?



