pdf调用成功,但是为什么打开的都是同一个pdf?

发布于 7 年前作者 mdu14338 次浏览最后编辑 7 年前来自 issues

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

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

4 回复
yang33
yang331 楼6 年前

这个问题我不会

dmao
dmao2 楼6 年前
                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)
                      }
                    })
                  }
                })


xiafang
xiafang3 楼6 年前

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

yang11
yang114 楼6 年前

请提供代码