From 74f116fc66820feb19c8728d5296e26c40f5ca6e Mon Sep 17 00:00:00 2001 From: qiang Date: Mon, 17 Oct 2022 22:41:08 +0800 Subject: [PATCH] docs: update getBatteryInfo --- docs/api/system/batteryInfo.md | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/api/system/batteryInfo.md b/docs/api/system/batteryInfo.md index b535f36ab..9a76df6cd 100644 --- a/docs/api/system/batteryInfo.md +++ b/docs/api/system/batteryInfo.md @@ -1,10 +1,22 @@ -#### 电量 +#### uni.getBatteryInfo(OBJECT) -电量API暂未统一,需分平台条件编译编写。 +获取设备电量 -- 微信小程序平台:[规范详情](https://developers.weixin.qq.com/miniprogram/dev/api/wx.getBatteryInfoSync.html) -- 百度小程序平台:[规范详情](https://smartprogram.baidu.com/docs/develop/api/device_battery/#swan-getBatteryInfo/) -- 支付宝小程序平台:[规范详情](https://docs.alipay.com/mini/api/nrnziy) -- QQ小程序平台:[规范详情](https://q.qq.com/wiki/develop/miniprogram/API/equipment/ibeacon_battery.html) -- App平台:使用 Native.js,[参考](https://ask.dcloud.net.cn/article/992) -- H5平台:使用 navigator.battery API +|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|飞书小程序|QQ小程序|快手小程序|京东小程序| +|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:| +|√[由uts插件支持](https://ext.dcloud.net.cn/plugin?id=9295)|√[由uts插件支持](https://ext.dcloud.net.cn/plugin?id=9295)|√[由uts插件支持](https://ext.dcloud.net.cn/plugin?id=9295)|[规范详情](https://docs.alipay.com/mini/api/nrnziy)|[规范详情](https://smartprogram.baidu.com/docs/develop/api/device_battery/#swan-getBatteryInfo/)|x|x|[规范详情](https://q.qq.com/wiki/develop/miniprogram/API/equipment/ibeacon_battery.html)|x|x| + +**OBJECT 参数说明** + +|参数名|类型|必填|说明| +|:-|:-|:-|:-| +|success|Function|否|接口调用成功的回调| +|fail|Function|否|接口调用失败的回调函数| +|complete|Function|否|接口调用结束的回调函数(调用成功、失败都会执行)| + +**success 返回参数说明** + +|参数|类型|说明| +|:-|:-|:-| +|level|Number|设备电量,范围 1 - 100| +|isCharging|Boolean|是否正在充电中| -- GitLab