UNPKG

hera-cli

Version:
36 lines (33 loc) 603 B
var app = getApp() Page({ data: { hasUserInfo: false }, getUserInfo: function () { var that = this if (app.globalData.hasLogin === false) { wx.login({ success: _getUserInfo }) } else { _getUserInfo() } function _getUserInfo () { wx.getUserInfo({ success: function (res) { that.setData({ hasUserInfo: true, userInfo: res.userInfo }) that.update() } }) } }, clear: function () { this.setData({ hasUserInfo: false, userInfo: {} }) } })