Page({ data: { isAgree: false }, handleAgreeChange(e) { this.setData({ isAgree: e.detail.value.length > 0 }) }, handleLogin() { if (!this.data.isAgree) { wx.showToast({ title: '请先同意用户协议和隐私政策', icon: 'none' }) return } wx.login({ success: (res) => { // 实现登录逻辑 console.log('登录成功', res) } }) } })