wx.openDocument打不开jpg文件
发布于 5 年前 作者 liaoxiulan 15740 次浏览 来自 问答
      wx.downloadFile({
url:"https://imgsrc.baidu.com/baike/pic/item/b21bb051f81986187aa0646a48ed2e738ad4e67d.jpg",
        success: function(res){
          // success
          console.log('down success')
          console.log(res.tempFilePath)
          var filePath = res.tempFilePath
          wx.openDocument({
            filePath: filePath,
            success: function(res){
              // success
              console.log('open success')
            },
            fail: function() {
              // fail
              console.log('open fail')
            },
            complete: function() {
              // complete
            }
          })
        },
        fail: function() {
          // fail
          console.log('down fail')
        },
        complete: function() {
          // complete
        }
      })

如上面代码,怎么总是返回“open fail”

1 回复

https://mp.weixin.qq.com/debug/wxadoc/dev/api/file.html?t=20161229#wxopendocumentobject

新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx

回到顶部