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,真机调试错误,以上测试代码,问题出在哪?
https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html
(filePath)
saveImageToPhotosAlbum用的图片路径是网路路径?是的话出错在这个不让用网络路径