小程序长按保存图片失败,什么问题?
var img = res.currentTarget.dataset.url;
if(img){
wx.getImageInfo({
src: img,
success: function (res) {
console.log(res);
wx.getSetting({
success: (res) => {
if (!res.authSetting['scope.writePhotosAlbum']) {
wx.authorize({
scope: 'scope.writePhotosAlbum',
success:()=> {
console.log('刚授权');
wx.saveImageToPhotosAlbum({
filePath : img
});
},
fail: (res) =>{
console.log(res);
}
})
}else{
console.log('已授权');
wx.saveImageToPhotosAlbum({
filePath : img
})
}
},
fail: (res) =>{
console.log(res);
}
})
}
}) ;
}
图片域名已添加downloadfile,真机调试错误,以上测试代码,问题出在哪?
2 回复