收藏
回答

怎么打开本地文档(word、pdf等)?

框架类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 wx.openDocument 、 wx.downloadFile 工具 6.6.3 1.9.93


直接用

wx.openDocument 好像不能是本地路径?! wx.downloadFile 也不能加载本地路径?


最后一次编辑于  2018-03-22
回答关注问题邀请回答
收藏

2 个回答

  • 彦迪
    彦迪
    2019-11-06

    fileType

    wx.openDocument({

    filePath: filePath,

    fileType:'',

    success: function (res) {

    console.log('打开文档成功')

    },


    2019-11-06
    有用
    回复
  • 林与鹤
    林与鹤
    2018-04-13

    我也遇到了这个问题,

    wx.downloadFile({

    url: 'https://demo.jerei.com/resources/web/heql.doc',

    success: function (res) {

    var filePath = res.tempFilePath

    wx.openDocument({

    filePath: filePath,

    success: function (res) {

    console.log('打开文档成功')

    },

    complete:e=>{

    console.log(e)

    }

    })

    并不好使,不知道错在哪里。

    2018-04-13
    有用
    回复
登录 后发表内容