

English
Get the current account information and return the Appid of the MiniApp. If the cloud plug-in of the WeChat MiniApp is used, the current plug-in Appid and version number can also be returned.
Platform Difference Description
App | H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 抖音小程序、飞书小程序 | QQ小程序 | 快手小程序 | 京东小程序 |
---|---|---|---|---|---|---|---|---|
x | x | √ | √ | x | x | √ | √ | √ |
return value
Object
account information
Property | Type | Description | Platform Difference Description |
---|---|---|---|
miniProgram | Object | MiniApp account information | |
plugin | Object | Plug-in account information (only included when called in the plug-in) | JD.com and Kuaishou MiniApp do not support |
The structure of the miniProgram
Property | Type | Description | Platform Difference Description |
---|---|---|---|
appId | string | MiniApp appId | |
envVersion | string | The current environment version of the MiniApp: develop development version, trial trial version, release official version, gray grayscale version (only supported by Alipay MiniApp) | Jingdong MiniApp not support |
version | string | The version number of the online MiniApp(only supported on the official version of the MiniApp) | Jingdong MiniApp not support |
plugin structure
property | type | description |
---|---|---|
appId | string | plugin appId |
version | string | Plugin version number |
Sample code
const accountInfo = uni.getAccountInfoSync();
console.log(accountInfo.miniProgram.appId); // 小程序 appId
console.log(accountInfo.plugin.appId); // 插件 appId
console.log(accountInfo.plugin.version); // 插件版本号, 'a.b.c' 这样的形式