caniuse.md 1.2 KB
Newer Older
D
DCloud_LXH 已提交
1 2 3 4 5 6 7
### uni.canIUse(String)
判断应用的 API,回调,参数,组件等是否在当前版本可用。

平台差异说明

|App|Web|微信小程序|支付宝小程序|百度小程序|字节跳动小程序、飞书小程序|QQ程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
D
DCloud_LXH 已提交
8
|√|√ (uni-app 3.4.13+)|√|√|√|√|√|
D
DCloud_LXH 已提交
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

**String 参数说明**

使用 ``${API}.${method}.${param}.${options}`` 或者 ``${component}.${attribute}.${option}`` 方式来调用,例如:

- ``${API}`` 代表 API 名字
- ``${method}`` 代表调用方式,有效值为return, success, object, callback
- ``${param}`` 代表参数或者返回值
- ``${options}`` 代表参数的可选值
- ``${component}`` 代表组件名字
- ``${attribute}`` 代表组件属性
- ``${option}`` 代表组件属性的可选值

**示例**

```javascript
uni.canIUse('getSystemInfoSync.return.screenWidth');
uni.canIUse('getSystemInfo.success.screenWidth');
uni.canIUse('showToast.object.image');
uni.canIUse('request.object.method.GET');

uni.canIUse('live-player');
uni.canIUse('text.selectable');
uni.canIUse('button.open-type.contact');
```
D
DCloud_LXH 已提交
34 35 36

**Tips**
- App、web 端暂不支持 ``${API}.${method}.${param}.${options}`` 方式调用,只支持 ``${API}``