微信小程序获取用户信息(新)
微信更新了之后,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息,开发者工具中依旧有弹窗,但真机调试或者体验版等都是不行的
新接口代码
<view class="container">
<view class="userinfo">
<block wx:if="{
{!hasUserInfo}}">
<button wx:if="{
{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>
<button wx:else open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称