downLoad(){
var timestamp = (new Date()).valueOf();
var downLoader = plus.downloader.createDownload(this.pdfPic, {
method: 'GET',
filename: '_downloads/image/' + timestamp + '.png'
}, function(download, status) {
console.log(status)
if(status==200){
var fileName = download.filename;
/**
* 保存至本地相册
*/
console.log(fileName)
plus.gallery.save(fileName, function() {
uni.showToast({
icon:'success',
title:'已保存至相册',
})
},function(){
uni.showToast({
icon:'success',
title:'保存失败,请重试',
})
});
}else{
uni.showToast({
icon:'success',
title:'下载失败,请重试',
})
}
});
downLoader.start();
},
uni-appvue 下载图片到相册
最新推荐文章于 2024-05-15 09:54:53 发布