Skip to main content
Version: Next

OpenData

Displays WeChat open data.

Reference

Type

ComponentType<OpenDataProps>

Examples

class App extends Component {
render () {
return (
<OpenData type='userAvatarUrl'/>
)
}
}

OpenDataProps

PropertyTypeDefaultRequiredDescription
type"groupName" | "userNickName" | "userAvatarUrl" | "userGender" | "userCity" | "userProvince" | "userCountry" | "userLanguage"YesThe type of the open data.
openGidstringNoThe ID of the group. It is valid when type="groupName".
lang"en" | "zh_CN" | "zh_TW""en"NoSpecifies the language used to display userInfo. It is valid when type="user*".
defaultTextstringNoDefault text when data is empty
defaultAvatarstringNoDefault image when user avatar is empty, supports relative paths and network image paths.
onErrorBaseEventOrigFunction<any>NoTriggered when the group name or user information is empty.

Property Support

PropertyWeChat Mini-ProgramH5React Native
OpenDataProps.type✔️
OpenDataProps.openGid✔️
OpenDataProps.lang✔️
OpenDataProps.defaultText✔️
OpenDataProps.defaultAvatar✔️
OpenDataProps.onError✔️

type

type Valid values of type

ValueDescription
groupNameThe name of the group
userNickNameThe nickname of the user
userAvatarUrlThe profile photo of the user
userGenderThe gender of the user
userCityThe city where the user is located
userProvinceThe province where the user is located
userCountryThe country where the user is located
userLanguageThe language used by the user

lang

Valid values of lang

ValueDescription
enEnglish
zh_CNSimplified Chinese
zh_TWTraditional Chinese

API Support

APIWeChat Mini-ProgramH5React Native
OpenData✔️