介绍:略
注意:button的父类需要设置: position: relative;
WXML中
<button class='repair-button' open-type="getUserInfo" hover-class="none"></button>
WXSS中
/* //透明按钮 */
.repair-button{
background: none;
border: none;
position: absolute;
width: 100%;
height: 100%;
top: 0px;
}
.repair-button::after{
background: none;
border: none;
}
获得用户信息
WXML
<button class='repair-button' open-type="getUserInfo" hover-class="none" bindgetuserinfo='bindGetUserInfo'></button>
JS
bindGetUserInfo: function (e) {
console.log(e.detail.userInfo)
if (e.detail.userInfo) {
//用户按了允许授权按钮
ut.log("用户按了允许授权按钮")
} else {
//用户按了拒绝按钮
ut.log("用户按了拒绝按钮")
}
},









网友评论