Skip to content

Commit ce270fe

Browse files
leezngLeopoldthecoder
authored andcommitted
When <el-form> missing model, validate will return false, then throw a warning to facilitate the developer troubleshooting
1 parent c1ce7a2 commit ce270fe

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/form/src/form.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@
6262
});
6363
},
6464
validate(callback) {
65+
if (!this.model) {
66+
console.warn('[Element Warn][Form]model is required for validate to work!');
67+
return;
68+
};
6569
let valid = true;
6670
let count = 0;
6771
// 如果需要验证的fields为空,调用验证时立刻返回callback

0 commit comments

Comments
 (0)