美文网首页
vue实现一个登录所有字段都被填写后,启用登录按钮

vue实现一个登录所有字段都被填写后,启用登录按钮

作者: 明眸yh | 来源:发表于2021-02-20 18:57 被阅读0次

需求

账号密码验证码三项均为必填,按钮可点击,否则按钮禁用状态

效果

代码

js代码

computed: {
  isLogin() {
    let boo = true
    if(this.query.user_name && this.query.pwd && this.query.code) {
      boo = false
    }
    return boo
  }
}

html代码

<van-button :disabled="isLogin" size="large" @click="verification" :loading="loginLoading" loading-text="登录中..." type="primary" block>登录</van-button>

相关文章

网友评论

      本文标题:vue实现一个登录所有字段都被填写后,启用登录按钮

      本文链接:https://www.haomeiwen.com/subject/wncxfltx.html