User information-related features have been adjusted. See the announcement at Mini Program Announcement on Adjustments to User Information-Related APIs for details.
Base Library 1.4.0 or later is required. For earlier versions, see compatibility handling.
Plugin: Not supported
WeChat for Windows: Supported
WeChat for macOS: Supported
WeChat for HarmonyOS: Supported
Rendering framework support: Skyline (debug using the latest Nightly tools), WebView
Feature Description
Used to display data shared by the WeChat Open Platform.
Common Attributes
| Attribute | Type | Default | Required | Description | Minimum Version | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| type | string | No | Open data type | 1.4.0 | |||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||
| open-gid | string | No | Effective when type="groupName"; Group ID | 1.4.0 | |||||||||||||||||||||||||||||
| lang | string | en | No | Effective when type="user*"; Specifies the language in which userInfo is displayed | 1.4.0 | ||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||
| default-text | string | No | Default text when data is empty | 2.8.1 | |||||||||||||||||||||||||||||
| default-avatar | string | No | Default image when user avatar is empty. Supports relative paths and network image URLs | 2.8.1 | |||||||||||||||||||||||||||||
| bind:error | eventhandle | No | Triggered when group name or user information is empty | 2.8.1 | |||||||||||||||||||||||||||||
Skyline-specific Properties
| Property | Type | Default Value | Required | Description | Minimum Version | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| type | string | No | Type of Open Data | 3.7.11 | ||||||||
|
||||||||||||
| default-text | string | No | Default text when data is empty | 3.7.11 | ||||||||
Bug & Tip
tip: You can only retrieve the group name if the current user is in this grouptip: To obtain the open-gid, please 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>