Taro.getAccountInfoSync()
Gets the information on the current account.
Type
() => AccountInfo
Parameters
AccountInfo
The account information.
Property | Type | Description |
---|---|---|
miniProgram | MiniProgram | The information on the Mini Program account |
plugin | Plugin | The information on the plug-in account (required only when this API is called from a plug-in) |
MiniProgram
miniProgram is composed as follows
Property | Type | Description |
---|---|---|
appId | string | The appId of the Mini Program |
Plugin
plugin is composed as follows
Property | Type | Description |
---|---|---|
appId | string | The AppID of the plug-in |
version | string | The version number of the plug-in |
Sample Code
const accountInfo = Taro.getAccountInfoSync();
console.log(accountInfo.miniProgram.appId) // The AppID of the Mini Program
console.log(accountInfo.plugin.appId) // The AppID of the plug-in
console.log(accountInfo.plugin.version) // The plug-in's version number in the format of 'a.b.c'
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Taro.getAccountInfoSync | ✔️ |