赞
踩
uni打开的文件名会不一样,因为预览的是临时地址,我们要做处理
- wx.downloadFile({
- url: response.data.fileUrl,
- filePath: wx.env.USER_DATA_PATH + '/' + '文件名' + '.xlsx', //.xlsx后缀名一定要加
- success: function (res) {
- if (res.statusCode == 200) {
- let filePath = res.filePath
- wx.openDocument({
- fileType: 'xlsx',
- filePath: filePath,
- showMenu: true,
- })
- }
- },
- fail: function (error) {
- toast.error('导出失败')
- }
- })

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。