May 19, 2021 WeChat Mini Program Development Document
Base Library 2.2.2 starts to support, and low versions need to be compatible.
Get current account information. The online gadget version number is only available in the official version of the program and is not available in the development and experience versions.
Account information
Property | Type | Description |
---|---|---|
miniProgram | Object | Small program account information |
plugin | Object | Plug-in account information (this item is included only when called in the plug-in) |
MiniProgram's structure
Property | Type | Description | The lowest version |
---|---|---|---|
appId | string | Small app Id | |
envVersion | string | The version of the small program | 2.10.0 |
version | string | Online gadget version number | 2.10.2 |
The legal value of miniProgram.envVersion
Value | Description | The lowest version |
---|---|---|
develop | Development version | |
trial | Experience edition | |
release | Official version |
Plugin's structure
Property | Type | Description |
---|---|---|
appId | string | Plug-in appId |
version | string | Plug-in version number |
const accountInfo = wx.getAccountInfoSync();
console.log(accountInfo.miniProgram.appId) // 小程序 appId
console.log(accountInfo.plugin.appId) // 插件 appId
console.log(accountInfo.plugin.version) // 插件版本号, 'a.b.c' 这样的形式