wx.opendocument 程序文件,opendocument怎么打开

2013-12-18
0 浏览
0 评论
闻道君

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

OBJECT参数说明:

参数 说明 必填 说明 最低版本
filePath String 是 文件路径,可通过 downFile 获得
fileType String 否 文件类型,指定文件类型打开文件,有效值 doc, xls, ppt, pdf, docx, xlsx, pptx 1.4.0
success Function 否 接口调用成功的回调函数
fail Function 否 接口调用失败的回调函数
complete Function 否 接口调用结束的回调函数(调用成功、失败都会执行)

示例代码

wx.downloadFile({
  url: 'http://example.com/somefile.pdf',
  success: function (res) {
    var filePath = res.tempFilePath
    wx.openDocument({
      filePath: filePath,
      success: function (res) {
        console.log('打开文档成功')
      }
    })
  }
})

****更多行业产品开发方案,请关注 加速度****

<以上资讯仅供参考,如需解决具体问题,建议您关注作者;如果有软件产品开发需求,可在线咨询获取产品开发方案和报价>

软件 软件开发 软件定制 软件公司
微信客服二维码

加客服微信获取更多内容