uniapp代码记录-保存图片到相册

    技术2022-07-13  77

    saveImgToLocal(e) { let _this = this; uni.showModal({ title: '提示', content: '确定保存到相册吗', success: function(res) { if (res.confirm) { //#ifdef APP-PLUS var p = plus.io.convertLocalFileSystemURL(_this.QRcodeImg); this.initImagePath = 'file:///' + p; //#endif console.log("图片: " + JSON.stringify(this.initImagePath)); uni.saveImageToPhotosAlbum({ filePath: this.initImagePath, success: function(e) { console.log("保存成功"); uni.showToast({ title: "保存成功", icon: "none" }); }, fail: function(e) { console.log("保存失败"); uni.showToast({ title: "保存失败", icon: "none" }); } }); } else if (res.cancel) { } } }); }
    Processed: 0.033, SQL: 9