Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

mc.chooseDocument(Object object)

新开页面打开文档。

Object object 参数

属性类型默认值必填说明最低版本
multipleBooleanfalse否是否多选
fileTypes[String]否指定选择文件类型数组,不填不限制
successFunction否接口调用成功的回调函数
failFunction否接口调用失败的回调函数
completeFunction否接口调用结束的回调函数(调用成功、失败都会执行) 

Object.fileTypes 的合法值

值说明最低版本
docdoc 格式
docxdocx 格式
xlsxls 格式
xlsxxlsx 格式
pptppt 格式
pptxpptx 格式
pdfpdf 格式 

Object.success(Object res) 回调函数

属性类型说明
tempFiles[Object]选择的文件数组

res.tempFiles 的结构

属性类型说明
tempFilePathString文件路径 (本地路径)
sizeNumber文件大小,以字节为单位
fileNameString文件名

示例代码:

mc.chooseDocument({
  multiple: false,
  fileTypes: ['pdf'],
  success: function(res){
      console.log(res.tempFiles[0].tempFilePath)
  }
})