小程序获取用户信息


1.获取用户信息:配合button组件使用
使用实例:
wxml:
<button wx:if="{{canIUse}}" open-type='getUserInfo' bindgetuserinfo='bindGetUserInfo' class='btn'></button>js:
bindGetUserInfo:function(e){console.log(e.detail)}encryptedData 解密后为以下 json 结构
{"openId": "OPENID","nickName": "NICKNAME","gender": GENDER,"city": "CITY","province": "PROVINCE","country": "COUNTRY","avatarUrl": "AVATARURL","unionId": "UNIONID","watermark":{"Appid":"APPID","timestamp":TIMESTAMP}}


    推荐阅读