xwt
2 天以前 0d3eadb50310ca60b8871e967e64da01aa25a9ad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
declare namespace UniNamespace {
  interface GetBatteryInfoSuccessCallbackResult {
    /**
     * 是否正在充电中
     */
    isCharging: boolean;
    /**
     * 设备电量,范围 1 - 100
     */
    level: number;
    errMsg: string;
  }
 
  interface GetBatteryInfoOption {
    /**
     * 接口调用结束的回调函数(调用成功、失败都会执行)
     */
    complete?: (result: any) => void;
    /**
     * 接口调用失败的回调函数
     */
    fail?: (result: any) => void;
    /**
     * 接口调用成功的回调函数
     */
    success?: (result: GetBatteryInfoSuccessCallbackResult) => void;
  }
}
 
interface Uni {
  /**
   * 获取设备电量
   *
   * 文档: [https://uniapp.dcloud.net.cn/api/system/batteryInfo.html](https://uniapp.dcloud.net.cn/api/system/batteryInfo.html)
   */
  getBatteryInfo(option?: UniNamespace.GetBatteryInfoOption): void;
}