pdf调用成功,但是为什么打开的都是同一个pdf?
发布于 6 年前 作者 mdu 14148 次浏览 来自 官方Issues

写两个按钮,在传值传两组写死数据,调用可以预览不通的pdf;

写成活的数据,预览的都是第一次加载过的pdf??这是为什么??

4 回复

这个问题我不会

                let filename = this.literatureObj.cellTitle;

                let fileUrl = res["data"]["downurl"]


                // let filename = "XXXX";
                // let fileUrl ="XXXX";
                let fileType = "pdf";
                let content =
                  "https://XXXX/DownLoadFileHandler?fn=" +
                  encodeURIComponent(filename) +
                  "&sign=" +
                  fileType +
                  "&downurl=" +
                  encodeURIComponent(fileUrl);
                 
                wx.downloadFile({
                  url: content,
                  success: function (res) {
                    const filePath = res.tempFilePath
                    wx.openDocument({
                      filePath: filePath,
                      fileType: fileType,
                      success: function (res) {
                        console.log('打开文档成功')
                      },
                      fail: function (res) {
                        console.log('打开失败')
                        console.log(res)
                      }
                    })
                  }
                })


关注,楼主,想请教一下,PDF怎么上传预览~~谢谢

请提供代码

回到顶部