Skip to content

Commit

Permalink
fix: 修复组件联动默认值bug 0.8.8-14
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Mar 4, 2021
1 parent b335cca commit e883e60
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "element-pro-crud",
"version": "0.8.8-13",
"version": "0.8.8-14",
"author": "BoBo<[email protected]>",
"main": "lib/ProCrud.umd.min.js",
"files": [
Expand Down Expand Up @@ -99,7 +99,6 @@
"lint-staged": {
"src/**/*.{js,vue,ts}": [
"npm run lint",
"npm run prettier",
"eslint --fix",
"git add"
]
Expand Down
9 changes: 8 additions & 1 deletion src/component/form-designer/src/GenerateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,14 @@ export default class GenerateForm extends Vue {
switch (_.operator) {
case 'show':
this.$set(field, 'hidden', false);
this.models[_.field] = _.value;
// 如果被联动组件值为空,默认显示规则中默认值
if ((!this.models[_.field] || this.models[_.field].length === 0) && _.value) {
if (Array.isArray(this.models[_.field])) {
this.models[_.field].push(_.value);
} else {
this.models[_.field] = _.value;
}
}
break;
case 'hidden':
this.$set(field, 'hidden', true);
Expand Down

0 comments on commit e883e60

Please sign in to comment.