Skip to content

Commit

Permalink
[fix]{GenerateForm}: 修复表单校验正则问题 trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Sep 20, 2019
1 parent 5c4eba8 commit 00f10eb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/FormDesigner/GenerateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,24 @@ export default {
this.setDefaultValue(genList[i]);
}
if (this.rules[genList[i].model]) {
this.rules[genList[i].model] = [...this.rules[genList[i].model], ...genList[i].rules.map((item) => {
if (item.pattern) {
// eslint-disable-next-line no-eval
return { ...item, pattern: eval(item.pattern) };
const rule = { ...item, pattern: eval(item.pattern) };
rule.trigger = 'blur';
return rule;
}
return { ...item };
})];
} else {
this.rules[genList[i].model] = [...genList[i].rules.map((item) => {
if (item.pattern) {
// eslint-disable-next-line no-eval
return { ...item, pattern: eval(item.pattern) };
const rule = { ...item, pattern: eval(item.pattern) };
rule.trigger = 'blur';
return rule;
}
return { ...item };
})];
Expand Down

0 comments on commit 00f10eb

Please sign in to comment.