allensimth
allensimth
  • 发布:2020-02-25 11:25
  • 更新:2022-03-17 19:08
  • 阅读:3917

uni-app h5 移动端在线浏览 office 文件

分类:uni-app

使用 uni.downloadFile 和 uni.openDocument 没有效果,

uni.downloadFile({  
  url: 'https://example.com/somefile.pdf',  
  success: function (res) {  
    var filePath = res.tempFilePath;  
    uni.openDocument({  
      filePath: filePath,  
      success: function (res) {  
        console.log('打开文档成功');  
      }  
    });  
  }  
});

难道是因为浏览器不支持

2020-02-25 11:25 负责人:无 分享
已邀请:
不想改Bug

不想改Bug

同问,怎么在线预览office文件啊

9***@qq.com

9***@qq.com - uniapp新手

getpdf() {
const url = 'https://mat.jixue2000.com/ssjf/resource/ssjf/courses/file/20190226/924/4fb7ce0ad8ec4fdeba280a0fef329e36.pdf';
uni.downloadFile({
url: url,
success: function (res) {
var filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
success: function (res) {
console.log('打开文档成功');
}
});
}
});
},

  • 9***@qq.com

    这么写完全就不支持

    2020-09-18 11:41

  • 2***@qq.com

    h5 都不支持

    2021-02-09 10:19

  • 5***@qq.com

    回复 9***@qq.com: 你解决了么

    2021-07-14 13:19

1***@qq.com

1***@qq.com - unnn

同问解决了吗

对你的感觉
不老刘

不老刘

H5不行吧。

3***@qq.com

3***@qq.com

uni.openDocument 方法H5不支持,可以看官网api

该问题目前已经被锁定, 无法添加新回复