uni.canvasToTempFilePath({
x: 0,
y: 0,
width: this.phoneW, // 画布的宽
height: this.phoneH - 100, // 画布的高
destWidth: this.phoneW * 2,
destHeight: (this.phoneH - 100) * 2,
fileType: 'jpg',
quality: Number(0.6),
canvasId: 'myCanvas',
success:(res)=> {
uni.hideLoading();
console.log("图片生成的结果", res, res.tempFilePath)
_this.$emit("tempFilePath", res.tempFilePath)
if (type == 1) {
_this.shareImg(res.tempFilePath);
} else if (type == 2) {
_this.shareFriends(res.tempFilePath)
} else if (type == 3) {
_this.saveCanvasImage(res.tempFilePath)
}
},
fail:(res)=> {
uni.showToast({
title: '生成失败,请重新生成',
duration: 2000,
icon: 'none'
})
uni.hideLoading();
}
},_this)

- 发布:2020-11-24 18:31
- 更新:2020-11-26 12:02
- 阅读:461
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: window11
HBuilderX类型: 正式
HBuilderX版本号: 2.9.8
手机系统: Android
手机系统版本号: Android 11
手机厂商: 华为
手机机型: p40
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
调起微信分享
调起微信分享
实际结果:
未调起微信分享
未调起微信分享
bug描述:
app真机调试可以调起uni.canvasToTempFilePath,但是打包成app后无法调起.
1 个回复
DCloud_UNI_LXH
您好,是没有走canvasToTempFilePath的回调是吧?那么有什么报错吗?可以详细的描述一下吗?