关于获取用户信息的问题(小白)
看了文档说是改版了,不会在app.js里获取用户信息,需要用户手动去点击某个按钮才能触发,然后获取信息,问题是这样的话在小程序里随便加个按钮就改变原来的样式了啊,请问大神我该怎么做呢?
2 回复
< view wx:if = '{{logined}}' class = "userinfo" > < image class = "userinfo-avatar" src = "{{userinfo.avatarUrl}}" background-size = "cover" bindtap = "chooseImage" ></ image > < text class = "userinfo-nickname" >{{userinfo.nickName}}</ text > </ view > < view wx:else class = "userinfo" > < button open-type = 'getUserInfo' bindgetuserinfo = "onGotUserInfo" >登录</ button > </ view > |
利用wx:if else判断是否登录,来显示不同的内容