userInfo对象
userInfo:{ avatarUrl: "头像链接" city: "城市" country: "国家" gender: 1(性别1/0) language: "语言" nickName: "昵称" province: "省份"
}
<view class="box"> <button class="btn" catchtap="GetUserInfo">登录</button> </view>
js
1 GetUserInfo(e) { 2 wx.getUserProfile({ 3 desc:‘正在获取‘,//不写不弹提示框 4 success:function(res){ 5 console.log(‘获取成功: ‘,res) 6 }, 7 fail:function(err){ 8 console.log("获取失败: ",err) 9 } 10 }) 11 }
效果图
原文:https://www.cnblogs.com/alanshreck/p/14488906.html