关于 Error in v-on handler: "TypeError: Cannot read property 'validate' of undefined" 问题

  1. 问题描述,如图
  2. 代码如下:
   <el-form :ref="userForm" :model="userForm" :rules="rules" label-width="80px" size="mini">
     <el-form-item label="用户名:" prop="userName">
       <el-input v-model="userForm.userName" placeholder="Android"></el-input>
     </el-form-item>
     <el-form-item label="密码" prop="userpassword">
   	<el-input type="password" v-model="userForm.userpassword" autocomplete="off"></el-input>
     </el-form-item>
     <el-form-item label="确认密码" prop="repeatWord">
   	<el-input type="password" v-model="userForm.repeatWord" autocomplete="off"></el-input>
     </el-form-item>
     <el-form-item label="权限:" prop="roleId">
   	<el-select v-model="userForm.roleId" filterable placeholder="请选择">
   		<el-option
   		v-for="item in roleList"
   		:key="item.roleId"
   		:label="item.roleName"
   		:value="item.roleId">
   		</el-option>
   	</el-select>
     </el-form-item>
     <el-form-item size="large">
       <el-button type="primary" @click="onSubmit( userForm )">立即创建</el-button>
     </el-form-item>
   </el-form>
</div>
onSubmit(userForm) {
			const t = this;
			console.log(userForm);
			debugger;
			// var _data = this.uniteInfo(tempChannel);
			var _url = "userAction_addUser";
			t.$refs.userForm.validate((valid) => {
				if(valid) {
					this.postInfo(_url,JSON.stringify(userForm));
				}else {
					alert("信息输入不完整");
					return false;
				}
			})
		  },

3.解决思路:
一、validate 未找到
二、这个$refs中没找到这个叫 userForm 的属性。通过 debugger;console控制台发
现,$refs中并没有这个属性。
4.解决方法:直接上图


:ref改为 ref$refs中便有了这个属性,问题解决