my.canIUse
Check whether the current Mini Program API, incoming parameter or return value, component, attribute, etc. are supported in the current version.
The parameters are called via ${API}.${type}.${param}.${option}
or ${component}.${attribute}.${option}
mode.
- API is the name of the API
- type value object/return/callback, indicating the api judgment type
- param indicates an attribute name of the parameter
- option indicates the detailed attribute value of the parameter attribute
- component indicates the name of the component
- attribute indicates the name of the component attribute
- option indicates the value of the component attribute
Sample Code
copy
// check whether newly added API is available
my.canIUse('getFileInfo')
// check whether newly added property of API is available
my.canIUse('getLocation.object.type')
// check whether newly added returned property of API is available
my.canIUse('getSystemInfo.return.brand')
// check whether newly added property of component is available
my.canIUse('button.open-type.getAuthorize')