Skip to content

Commit

Permalink
[fix]{GenerateForm}: 修复正则校验bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Aug 19, 2019
1 parent f939b5c commit df5b2f9
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/components/FormDesigner/GenerateForm.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
* @file:
* @copyright: NanJing Anshare Tech .Com
* @author: BoBo
* @Date: 2019-03-21 16:47:49
-->
<template>
<div>
<el-form
Expand Down Expand Up @@ -203,13 +209,23 @@ export default {
} else {
this.setDefaultValue(genList[i]);
}
if (this.rules[genList[i].model]) {
this.rules[genList[i].model] = [
...this.rules[genList[i].model],
...genList[i].rules,
];
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) };
}
return { ...item };
})];
} else {
this.rules[genList[i].model] = [...genList[i].rules];
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) };
}
return { ...item };
})];
}
}
}
Expand Down

0 comments on commit df5b2f9

Please sign in to comment.