Js add code corresponding folder inside the inside, for example: index.js
//////// code begins ///////////
onLoad: function () {
var that = this
// Check whether to authorize
wx.getSetting({
success(res) {
if (res.authSetting['scope.userInfo']) {
// has authorized, you can call directly getUserInfo acquired the nickname Avatar
wx.getUserInfo({
success: function (res) {
that.setData({
info: res.userInfo
})
}
})
}
}
})
}
//////// Code ending ///////////
{{Info.nickName}} so wxml which can show the user's name, other fields print their own res.data View