选择文件接口
import { MFileExplorer } from "@yl/super-jssdk"
MFileExplorer.chooseFile()
| 参数 | 类型 | 作用 |
|---|---|---|
| resolve(infos) | Function | 成功回调,infos格式为array,返回选中的文件内容,格式如下 |
| reject(err) | Function | 失败回调,err为详细错误信息,是一个json对象,例如:{"errCode":-1,"errMsg":"出错啦"} |
infos
// success(infos) infos 内容释义
[
{
"filename": "report",// 文件名
"path": "file:///storage/emulated/0/solopi/share/report.zip",// 文件路径
"size": 66721,// 文件大小,单位:byte
"suffix": "zip"// 文件后缀
}
]
MFileExplorer.chooseFile()
.then((infos) => {
console.log(infos);
})
.catch(err => {
console.log('插件调用失败:', err)
})