微信小程序解决华为手机保存图片到相册失败
1.新增隐私设置
2.优化代码 新增uni.authorize判断
_saveCode() {
let that = this;
console.log('点击了保存图片')
console.log(this.result)
uni.authorize({
scope: 'scope.writePhotosAlbum',
success(e) {
console.log(e)
if (this.result != "") {
uni.saveImageToPhotosAlbum({
filePath: that.result,
success: function() {
uni.showToast({
title: '二维码保存成功',
icon: 'success',
duration: 2000
});
}
});
}
},
fail(e){
console.log('失败了')
console.log(e)
uni.openSetting({
success(res) {
console.log(res.authSetting)
}
});
}
})
},