From 21e1ab33710c1980c87b26fd41cc576b5676c6a9 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Thu, 25 May 2023 19:51:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ts-doc=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uni-getbatteryinfo/utssdk/interface.uts | 107 ++++++++++++------ 1 file changed, 70 insertions(+), 37 deletions(-) diff --git a/uni_modules/uni-getbatteryinfo/utssdk/interface.uts b/uni_modules/uni-getbatteryinfo/utssdk/interface.uts index c32541b..7f58b1e 100644 --- a/uni_modules/uni-getbatteryinfo/utssdk/interface.uts +++ b/uni_modules/uni-getbatteryinfo/utssdk/interface.uts @@ -1,49 +1,49 @@ export type GetBatteryInfoSuccess = { - errMsg : string, - /** - * 设备电量,范围1 - 100 - */ - level : number, - /** - * 是否正在充电中 - */ - isCharging : boolean + errMsg : string, + /** + * 设备电量,范围1 - 100 + */ + level : number, + /** + * 是否正在充电中 + */ + isCharging : boolean } export type GetBatteryInfoFail = { - /** - * 错误码 - */ - errCode : number, - /** - * 调用API的名称 - */ - errSubject : string, - /** - * 错误的详细信息 - */ - errMsg : string, - /** - * 错误来源 - */ - cause : any | null + /** + * 错误码 + */ + errCode : number, + /** + * 调用API的名称 + */ + errSubject : string, + /** + * 错误的详细信息 + */ + errMsg : string, + /** + * 错误来源 + */ + cause : any | null } export type GetBatteryInfoOptions = { - /** - * 接口调用结束的回调函数(调用成功、失败都会执行) - */ - success ?: (res : GetBatteryInfoSuccess) => void - /** - * 接口调用失败的回调函数 - */ - fail ?: (res : GetBatteryInfoFail) => void - /** - * 接口调用成功的回调 - */ - complete ?: (res : any) => void + /** + * 接口调用结束的回调函数(调用成功、失败都会执行) + */ + success ?: (res : GetBatteryInfoSuccess) => void + /** + * 接口调用失败的回调函数 + */ + fail ?: (res : GetBatteryInfoFail) => void + /** + * 接口调用成功的回调 + */ + complete ?: (res : any) => void } /** @@ -62,5 +62,38 @@ export type GetBatteryInfo = (options : GetBatteryInfoOptions) => void interface Uni { + + /** + * 获取电池电量信息 + * @description 获取电池电量信息 + * @param {GetBatteryInfoOptions} options + * @example + * ```typescript + * uni.getBatteryInfo({ + * success(res) { + * console.log(res); + * } + * }) + * ``` + * @remark + * - 该接口需要同步调用 + * @uniPlatform { + * "app": { + * "android": { + * "osVer": "4.4.4", + * "uniVer": "3.6.11", + * "unixVer": "3.9.0" + * }, + * "ios": { + * "osVer": "8.0", + * "uniVer": "3.6.11", + * "unixVer": "3.9.0" + * } + * } + * } + * @uniVueVersion 2,3 //支持的vue版本 + * + */ getBatteryInfo : GetBatteryInfo + } \ No newline at end of file -- GitLab