当前位置:   article > 正文

uniapp excel打开文字重命名_uni.opendocument(object)打开文档时重新设置文件名

uni.opendocument(object)打开文档时重新设置文件名

uni打开的文件名会不一样,因为预览的是临时地址,我们要做处理

  1. wx.downloadFile({
  2. url: response.data.fileUrl,
  3. filePath: wx.env.USER_DATA_PATH + '/' + '文件名' + '.xlsx', //.xlsx后缀名一定要加
  4. success: function (res) {
  5. if (res.statusCode == 200) {
  6. let filePath = res.filePath
  7. wx.openDocument({
  8. fileType: 'xlsx',
  9. filePath: filePath,
  10. showMenu: true,
  11. })
  12. }
  13. },
  14. fail: function (error) {
  15. toast.error('导出失败')
  16. }
  17. })

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/264096
推荐阅读
相关标签
  

闽ICP备14008679号