saveImg() {
var that = this
wx.request({
url: 接口地址,
method: 'POST',
header: {
'token': getApp().globalData.token
},
data: {},
success(res) {
// console.log('save', res);
var imgurl = res.data.data.url
wx.downloadFile({
url: getApp().globalData.url + imgurl,
success(res) {
// console.log('img', res);
const tempFilePath = res.tempFilePath
// console.log('tempFilePath', tempFilePath);
wx.saveImageToPhotosAlbum({
filePath: tempFilePath,
success: function () {
wx.showToast({
title: '保存成功',
})
}
})
}
})
}
})
}
微信小程序 保存图片
于 2022-05-23 10:09:43 首次发布