赞
踩
临时文件存放区:wx.env.USER_DATA_PATH
// 下载资料 downloadDrawingZip() { this.canDownload = true uni.showLoading({ title: '正在下载......' }) let realFileName = orderId + '.zip' let fileSavePath = wx.env.USER_DATA_PATH + '/' + realFileName console.log('106', fileSavePath) wx.downloadFile({ url: '#你的接口url', header: { 'Content-Type': 'application/octet-stream' }, filePath: fileSavePath, success: (res) => { console.log(111, res) uni.hideLoading() wx.shareFileMessage({ filePath: res.filePath, fileName: realFileName, success(data) { uni.showToast({ icon: 'success', mask: true, title: '转发成功!', duration: 2000, }); }, fail: console.error, }) this.canDownload = false }, fail: (err) => { console.error(err) uni.showToast({ icon: 'error', title: '下载失败!', duration: 3000 }) this.canDownload = false } }) }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。