savePicture (imgUrl) {
let that = this
this.$vux.confirm.show({
title: '提示',
content: '确认保存图片到相册',
onConfirm () {
let timestamp = new Date().getTime()
let format = 'kedui' + timestamp + '.jpg'
api.download({
url: imgUrl,
savePath: 'fs://' + format,
encode: false,
report: false,
cache: false,
allowResume: true
},function(ret, err){
if (ret.state == 1) {
api.saveMediaToAlbum({
path: 'fs://' + format
}, function(ret, err) {
if (ret && ret.status) {
that.$vux.toast.text('图片已经保存到相册')
} else {
that.$vux.toast.text('保存失败')
}
});
}
})
}
})
},
apicloud实现图片保存
最新推荐文章于 2023-10-13 15:30:22 发布