⼩程序制作⼀键登录按钮wxml
<view class="content_3">
<button open-type="getUserInfo"type="primary" lang="zh_CN" bindgetuserinfo="onGotUserInfo">
<image class="btnImg" src="../../images/login/wechat.png"></image>
⽤户⼀键登录</button>
<view class="tip">
<text>点击登录,即代表已阅读并同意</text><text bindtap="userAgreement">《⽤户注册协议》</text> </view>
<view class="phone_login" bindtap="phoneLogin">
<text>输⼊⼿机号码登录/注册</text>
</view>
</view>
wxss
.btnImg {
margin-right: 8rpx;
width: 48rpx;
height: 46rpx;
}
.content_3 button {
display: flex;
flex-direction: row;
小程序开发一键生成平台源码align-items: center;
justify-content: center;
}
.content_3 {
padding:0%5%
}
js
onGotUserInfo: function(e){
console.log(e)
if(Msg !="getUserInfo:fail auth deny"){
/**获取⽤户信息**/
success: res =>{
console.log(res)
app.globalData.userInfo = res.userInfo
wx.setStorage({
key:'userInfo',
data: res.userInfo,
})
}
})
}
},
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论