Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
429 views
in Technique[技术] by (71.8m points)

使用Vue Element-UI进行表单验证如何获得表单整体的验证状态

有一个需求是在表单某个字段未通过时按钮变灰不可点击,随着验证通过变为可以点击,我在表单的validate事件中调用this.$refs['form'].validate()但是却报了[Maximum call stack size exceeded]这种错误,请问有办法能直接获得表单整体的验证状态吗

<el-form @validate="validateForm">


validateForm(filed, valid, msg)?{
let form = this.$refs['form'];
 form.validate().then(res=>{
     console.log(res);
    }).catch(err=>{~~~~
        console.log(err)
    });
 },

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

看看文档啊 贝贝

this.$refs[formName].validate((valid, obj) => {
                console.log(valid, 'valid', obj);
                if (valid) {

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...