wx.showShareImageMenu() 点击保存到相册提示暂无权限 如何能在点击保存到相册时获取权限?
代码
wx.canvasToTempFilePath({
canvasId: 'shareCanvas',
x: 0,
y: 0,
width: this.canvasW,
height: this.canvasH,
destWidth: this.canvasW * 2,
destHeight: this.canvasH * 2,
quality: 1.0,
success: (res) => {
// 调起分享菜单
wx.showShareImageMenu({
path: res.tempFilePath,
success: () => {
uni.showToast({
title: '分享入口已打开',
icon: 'success'
});
},
fail: (err) => {
console.error('调起分享菜单失败:', err);
uni.showToast({
title: '如果点击保存相册,请先前往右上角设置打开相册权限',
icon: 'none'
});
},
complete: () => {
this.isLoading = false;
}
});
},
fail: (err) => {
console.error('生成临时图片失败:', err);
uni.showToast({
title: '图片生成失败',
icon: 'none'
});
this.isLoading = false;
}
}, this);
});

报错截图看看
wx.canvasToTempFilePath({
canvasId: 'shareCanvas',
x: 0,
y: 0,
width: this.canvasW,
height: this.canvasH,
destWidth: this.canvasW * 2,
destHeight: this.canvasH * 2,
quality: 1.0,
success: (res) => {
// 调起分享菜单
wx.showShareImageMenu({
path: res.tempFilePath,
success: () => {
uni.showToast({
title: '分享入口已打开',
icon: 'success'
});
},
fail: (err) => {
console.error('调起分享菜单失败:', err.errMsg);
// uni.showToast({
// title: '分享失败,请重试',
// icon: 'none'
// });
},
complete: () => {
this.isLoading = false;
}
});
},