Get user information: open-data
The official documentation of open-data
The following is the specific description of open-data in the official WeChat document. You can check it out according to your needs.
Specific examples of open-data use
Requirements: I want to get the user's avatar and nickname information.
Method: Use open-data to
achieve: query the document. When the type is userAvatarUrl and userNickName, they are represented as user avatar and user nickname respectively.
Code:
<open-data type="userAvatarUrl"></open-data>
<open-data type="userNickName" lang="zh_CN"></open-data>
In userNickName, zh_CN is selected as the value of lang, that is, simplified Chinese is used to display the user's nickname.
Specific effects:
About other methods of obtaining user information
Use . This.setData and getApp () globalData.userInfo
specific implementation See: How to use this.setData and getApp () globalData.userInfo obtain user information.
Hope this article is useful to you! Welcome to discuss, exchange and learn!