element验证不通过焦点自动跳转

    this.$refs[formName].validate((valid) => {
        if (valid) {
             //...
        } else {
            this.nextTick(()=>{
                var isError= document.getElementsByClassName("is-error");
                isError[0].querySelector('input').focus();
            })
          return false;
        }
    }

猜你喜欢

转载自blog.csdn.net/weixin_39308542/article/details/91381875