Analysis of the open type attribute principle of button tag in wechat applet


This article mainly introduces the principle analysis of button tag open type attribute of wechat applet. The example code is introduced in detail in this article, which has certain reference learning value for everyone’s study or work. You can refer to the following for your friends

Open type: one of the legal values:

GetUserInfo Description: guide user authorization to obtain user information, which can be obtained from bindgetuserinfo callback

The bindgetuserinfo attribute of the button indicates that when the user clicks the button, the obtained user information will be returned. The detail data of the callback is the same as that of wx.getuserinfo, which is valid when open type = “getUserInfo”

Such as:


Wxml file:

.js file:


Wxml file:

.js file:

In this way, users are required to authorize when clicking, and obtain user information (open type = “getUserInfo”) when authorizing login (bindgetuserinfo = “user defined function name”)!

(or get the user information (open type = “getUserInfo”) to authorize login (bindetuserinfo = “user defined function name”))

The above is the whole content of this article. I hope it will help you in your study, and I hope you can support developepaer more.