收藏
回答

wx.openDocument打不开jpg文件

      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 个回答

  • Special
    Special
    2016-12-30

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


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

    2016-12-30
    有用
    回复
登录 后发表内容