vue表单校验提交报错TypeError: Cannot read property 'validate' of undefined

时间:2021-09-08 16:18:38
TypeError: Cannot read property 'validate' of undefined at VueComponent.submitForm (plat_users.html:385) at Proxy.boundFn (vue.js:130) at click (eval at makeFunction (vue.js:8480), <anonymous>:2:5611) at VueComponent.invoker (vue.js:1948) at VueComponent.Vue.$emit (vue.js:2549) at VueComponent.handleClick (element-ui.js:3) at boundFn (vue.js:130) at HTMLButtonElement.invoker 

原因是 @click="submitForm(ruleForm)" 中的 ruleForm 没有使用引号。

正确写法:

<el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>