微信小程序如何下载word或者ppt或者excel?官方提供的savefile保存到本地找不到文件 |
您所在的位置:网站首页 › doc文件如何保存到手机 › 微信小程序如何下载word或者ppt或者excel?官方提供的savefile保存到本地找不到文件 |
savefiles(e) { const fileName = e.currentTarget.dataset.name; //获取页面要下载的文件名 console.log(window.wx.env.USER_DATA_PATH); wx.downloadFile({ url: fileName, success: res => { console.log(res); wx.saveFile({ filePath: res.tempFilePath, success(r) { wx.showToast({ title: '保存成功', icon: 'success', }); }, fail(err) { console.log(err); if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') { wx.openSetting({ success(settingdata) { if (settingdata.authSetting['scope.writePhotosAlbum']) { console.log( '获取权限成功,给出再次点击图片保存到相册的提示。' ); } else { console.log( '获取权限失败,给出不给权限就无法正常使用的提示' ); } }, }); } }, }); }, fail: err => { console.log(err, '下载失败'); }, }); }, |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |