赞
踩
处理方法:将文件地址链接后缀名截取下来动态塞进去。
- openFile(e) {
- console.log(e);
- uni.showLoading({
- title: '加载中'
- })
- uni.downloadFile({
- url: e.url,
- success: function(res) {
- uni.hideLoading();
- const filePath = res.tempFilePath;
- const index = e.url.lastIndexOf(".");
- const suffix = e.url.substring(index+1);
- uni.openDocument({
- fileType: suffix,
- filePath: filePath,
- success: function(res) {
- console.log('打开文档成功')
- }
- })
- }
- })
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。