Skip to content

Commit

Permalink
fix: 修复正则表达式触发bug @0.9.4-11
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed May 19, 2021
1 parent f9c43fb commit 3847c1c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "element-pro-crud",
"version": "0.9.4-10",
"version": "0.9.4-11",
"author": "BoBo<[email protected]>",
"main": "lib/pro-crud.js",
"files": [
Expand Down
19 changes: 13 additions & 6 deletions src/component/pro-form/src/ProFormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
感谢大佬!
-->
<template>
<el-form-item
:rules="widget.rules || []"
:prop="formElement.includes(widget.type) ? widget.model : undefined"
:label-width="widget.options.hiddenLabel ? '0' : labelWidth"
:class="widget.options.className"
>
<el-form-item :rules="getRules" :prop="formElement.includes(widget.type) ? widget.model : undefined" :label-width="widget.options.hiddenLabel ? '0' : labelWidth" :class="widget.options.className">
<template #label>
<template v-if="widget.options.hiddenLabel ? '' : label">
<span v-html="label"></span>
Expand Down Expand Up @@ -500,6 +495,18 @@ export default class ProFormItem extends Vue {
}
}

get getRules() {
const arr = this.widget.rules || [];
if (arr) {
arr.forEach((element) => {
if (element.pattern) {
element.pattern = new RegExp(this.widget.options.pattern);
}
});
}
return arr;
}

// 子表在只读模式下隐藏增删改按钮
get tableVisibleList() {
const view = {
Expand Down

0 comments on commit 3847c1c

Please sign in to comment.