Skip to content

Commit 00f10eb

Browse files
committed
[fix]{GenerateForm}: 修复表单校验正则问题 trigger
1 parent 5c4eba8 commit 00f10eb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/FormDesigner/GenerateForm.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,19 +210,24 @@ export default {
210210
this.setDefaultValue(genList[i]);
211211
}
212212
213+
213214
if (this.rules[genList[i].model]) {
214215
this.rules[genList[i].model] = [...this.rules[genList[i].model], ...genList[i].rules.map((item) => {
215216
if (item.pattern) {
216217
// eslint-disable-next-line no-eval
217-
return { ...item, pattern: eval(item.pattern) };
218+
const rule = { ...item, pattern: eval(item.pattern) };
219+
rule.trigger = 'blur';
220+
return rule;
218221
}
219222
return { ...item };
220223
})];
221224
} else {
222225
this.rules[genList[i].model] = [...genList[i].rules.map((item) => {
223226
if (item.pattern) {
224227
// eslint-disable-next-line no-eval
225-
return { ...item, pattern: eval(item.pattern) };
228+
const rule = { ...item, pattern: eval(item.pattern) };
229+
rule.trigger = 'blur';
230+
return rule;
226231
}
227232
return { ...item };
228233
})];

0 commit comments

Comments
 (0)