# uni.canIUse(String)

Determine whether the application's API, callbacks, parameters, components, etc. are available in the current version.

Platform Difference Description

App HarmonyOS Next Web 微信小程序 支付宝小程序 百度小程序 抖音小程序、飞书小程序 QQ程序 元服务 小红书小程序
HBuilder 4.23 √ (uni-app 3.4.13+)

String parameter description

Use ${API}.${method}.${param}.${options} or ${component}.${attribute}.${option} to call, for example:

  • ${API} represents the API name
  • ${method} represents the calling method, valid values are return, success, object, callback
  • ${param} represents a parameter or return value
  • ${options} represents the optional value of the parameter
  • ${component} represents the component name
  • ${attribute} represents component attributes
  • ${option} represents the optional value of the component property

Example

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');

Tips

  • App、web 端暂不支持 ${API}.${method}.${param}.${options} 方式调用,只支持 ${API}
  • App、Web 端部分 API 实际未实现,具体结果以 API 页面实现表格为准
On This Page