| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- /**
- * interface.uts
- * uts插件接口定义文件,按规范定义接口文件可以在HBuilderX中更好的做到语法提示
- */
- /**
- * myApi 异步函数的参数,在type里定义函数需要的参数以及api成功、失败的相关回调函数。
- */
- export type ChooseFileOptions = {
- success ?: (res : ChooseFileResult) => void
- fail ?: (res : ChooseFileFail) => void
- complete ?: (res : any) => void
- }
- /**
- * 函数返回结果
- * 可以是void, 基本数据类型,自定义type, 或者其他类型。
- * [可选实现]
- */
- // 返回文件的路径、名称、大小
- export type ChooseFileResult = {
- size : number,
- path : string,
- name : string
- }
- /**
- * 错误码
- * 根据uni错误码规范要求,建议错误码以90开头,以下是错误码示例:
- * - 9010001 错误信息1
- * - 9010002 错误信息2
- */
- export type ChooseFileErrorCode = 9010001 | 9010002;
- /**
- * ChooseFile 的错误回调参数
- */
- export interface ChooseFileFail extends IUniError {
- errCode : ChooseFileErrorCode
- };
- /*
- 异步函数定义
- interface中的方法 如ChooseFile 提供给各端组件去使用
- */
- // 选择文件
- export type ChooseFile = (options : ChooseFileOptions) => void
|