アイデア: チェックされているかどうかを判断するためのクリックイベントボタンと、ユーザー情報を取得するために使用する認証ログインボタンの 2 つの同一のボタンを設定します。
<button class='bottom' wx:if="{
{checked==false}}" bindtap="handleAgree">授权登录</button>
<button class='bottom' wx:else open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">授权登录</button>
data:{
checked:false
},
handleAgree() {
if (!this.data.checked) {
wx.showToast({
icon: "none",
title: '请阅读并同意平台服务协议及隐私协议',
duration: 2000
})
return false
}
},