- 真机调试点击保存图片没有反应
saveImg: function () { wx.openSetting({ success: (res) => { if (res.authSetting['scope.writePhotosAlbum']) { console.log('开启权限成功') } } }) wx.downloadFile({ url: this.data.tempFilePath2, success: function (res) { wx.openSetting({ success(settingdata) { console.log(settingdata) if (settingdata.authSetting['scope.writePhotosAlbum']) { console.log('获取权限成功,给出再次点击图片保存到相册的提示。') } } }) let path = res.tempFilePath wx.saveImageToPhotosAlbum({ filePath: path, success(res) { console.log(res) }, fail(res) { console.log(res) }, complete(res) { console.log(res) } }) }, fail: function (res) { console.log(res); if (res.errMsg === "saveImageToPhotosAlbum:fail auth deny") { console.log("用户一开始拒绝了,我们想再次发起授权") console.log('打开设置窗口') wx.openSetting({ success(settingdata) { console.log(settingdata) if (settingdata.authSetting['scope.writePhotosAlbum']) { console.log('获取权限成功,给出再次点击图片保存到相册的提示。') } } }) } } }) },
2018-06-09 - 一个按钮可重复添加图片
按钮如何多次添加图片
2018-05-19