wx.openDocument(Object object)

您所在的位置:网站首页 ios预览文件 wx.openDocument(Object object)

wx.openDocument(Object object)

2024-07-15 21:05| 来源: 网络整理| 查看: 265

# wx.openDocument(Object object)

以 Promise 风格 调用:支持

小程序插件:支持,需要小程序基础库版本不低于 2.15.0

微信 Windows 版:支持

微信 Mac 版:支持

相关文档: 文件系统

# 功能描述

新开页面打开文档。微信客户端 7.0.12 版本前默认显示右上角菜单按钮,之后的版本默认不显示,需主动传入 showMenu。

# 参数 # Object object 属性 类型 默认值 必填 说明 最低版本 filePath string 是 文件路径 (本地路径) ,可通过 downloadFile 获得 showMenu boolean false 否 是否显示右上角菜单 2.11.0 fileType string 否 文件类型,指定文件类型打开文件 1.4.0 合法值 说明 doc doc 格式 docx docx 格式 xls xls 格式 xlsx xlsx 格式 ppt ppt 格式 pptx pptx 格式 pdf pdf 格式 success function 否 接口调用成功的回调函数 fail function 否 接口调用失败的回调函数 complete function 否 接口调用结束的回调函数(调用成功、失败都会执行) # 示例代码 wx.downloadFile({ // 示例 url,并非真实存在 url: 'http://example.com/somefile.pdf', success: function (res) { const filePath = res.tempFilePath wx.openDocument({ filePath: filePath, success: function (res) { console.log('打开文档成功') } }) } })


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3