/* 打开文档
* @param fileUrl: 文件地址
* @param filetype: 文件类型
*/
openDocument(fileUrl, filetype) {
    wx.downloadFile({
        url: fileUrl,
        success: res => {
            const filePath = res.tempFilePath;
            wx.openDocument({
                 filePath: filePath,
                 fileType: filetype,
                 success: function (res) {
                    // console.log("打开文档成功")
                 },
                 fail: function (res) {
                    wx.showToast({title: '打开文档失败', icon: 'none', duration: 2000})
                 },
            })
         },
         fail: res => {
             console.log(res);
         },
   });
}

 

相关文章:

  • 2022-01-14
  • 2021-12-05
  • 2021-11-13
  • 2021-10-29
  • 2022-02-11
  • 2022-12-23
猜你喜欢
  • 2022-01-11
  • 2021-11-19
  • 2022-02-25
  • 2021-04-14
  • 2021-11-23
  • 2021-07-29
相关资源
相似解决方案