WeChat Open Platform

Mini Programs Documentation

System information

wx.canIUse(String)

Determines whether Mini Program APIs, callbacks, parameters, or components are available in the current version.

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

  • ${API} represents API name
  • ${method} represents call method, valid values are return, success, object, and callback
  • ${param} represents parameter or return value
  • ${options} represents selected value for parameter
  • ${component} represents component name
  • ${attribute} represents component attribute
  • ${option} represents selected value for component attribute

Examples:

wx.canIUse('openBluetoothAdapter')
wx.canIUse('getSystemInfoSync.return.screenWidth')
wx.canIUse('getSystemInfo.success.screenWidth')
wx.canIUse('showToast.object.image')
wx.canIUse('onCompassChange.callback.direction')
wx.canIUse('request.object.method.GET')

wx.canIUse('contact-button')
wx.canIUse('text.selectable')
wx.canIUse('button.open-type.contact')