声明:本站文章均为作者个人原创,图片均为实际截图。如有需要请收藏网站,禁止转载,谢谢配合!!!

先下载,再保存

uni.downloadFile({
    url,
    success: (res) =>{
        if (res.statusCode === 200){
            uni.saveImageToPhotosAlbum({
                filePath: res.tempFilePath,
                success: function() {
                    uni.showToast({
                        title: "保存成功",
                        icon: "none"
                    });
                },
                fail: function(err) {
                    console.log('saveerr', err)
                    uni.showToast({
                        title: "保存失败,请稍后重试",
                        icon: "none"
                    });
                }
            });
        }
    },
    fail: (err) => {
        console.log('downerr', err)
    }
})