# open-data
Start from base library version 1.4.0. Please remaining backward compatible.
Used to display WeChat open data.
Cannot be used in Mini Programs.
| attribute | type | Default value | Required | Introductions | Minimum version |
|---|---|---|---|---|---|
| type | string | no | Open Data Type | 1.4.0 | |
| open-gid | string | no | when type="groupName" Is effective when, Group id | 1.4.0 | |
| long | string | in | no | when type="user*" In what language? userInfo | 1.4.0 |
| default-text | string | no | Default copy when data is empty | 2.8.1 | |
| default-avatar | string | no | Default picture when the user's avatar is empty, support relative path and network picture path | 2.8.1 | |
| binderror | eventhandle | no | Triggered when the group name or user information is empty | 2.8.1 |
type Legal value
| value | Introductions | Minimum version |
|---|---|---|
| groupName | Pull group name | 1.4.0 |
| userNickName | User nickname | 1.9.90 |
| userAvatarUrl | User profile | 1.9.90 |
| userGender | User Gender | 1.9.90 |
| userCity | User City | 1.9.90 |
| userProvince | User's province | 1.9.90 |
| userCountry | Country of user | 1.9.90 |
| userLanguage | User Language | 1.9.90 |
long Legal value
| value | Introductions | Minimum version |
|---|---|---|
| in | English | |
| zh_CN | Simplified Chinese | |
| zh_TW | Traditional Chinese |
# Bug & Tip
tipOnly the current user can pull the group name in this grouptipFor getting open - gid, use wx.getShareInfo
# sample code
<open-data type="groupName" open-gid="xxxxxx"></open-data>
<open-data type="userAvatarUrl"></open-data>
<open-data type="userGender" lang="zh_CN"></open-data>