微信小程序打开pdf文件

1,202 阅读1分钟
 see() {
   let that = this
   wx.showToast({
     title: '正在打开',
     icon: 'loading',
     duration: 3000
   })
   wx.downloadFile({
     url: that.data.details_list.pdfUrl,
     success: function(res) {
       console.log(res)
       const filePath = res.tempFilePath
       console.log(filePath)
       wx.openDocument({
         fileType: 'pdf',
         filePath: filePath,
         success: function(res) {
           console.log('打开文档成功')
           console.log(res)
         },
         fail: function(res) {
           console.log('打开文档失败')
         }
       })
     }
   })

 },