Skip to content

Commit

Permalink
fix(table): filter table pass value improvement (#2623)
Browse files Browse the repository at this point in the history
* fix(table): filter table pass value

* fix(table): empty
  • Loading branch information
chaishi committed Jul 27, 2023
1 parent dbcd0d7 commit 8b50999
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/checkbox/group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export default defineComponent({
props={option}
index={index}
data={option}
checked={this.innerValue.includes(option.value)}
checked={this.innerValue?.includes(option.value) || false}
storeKey={this.storeKey}
scopedSlots={this.$scopedSlots}
></Checkbox>
Expand Down
12 changes: 4 additions & 8 deletions src/table/filter-controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ export default defineComponent({
const filterComponentProps: { [key: string]: any } = {
options: ['single', 'multiple'].includes(column.filter.type) ? column.filter?.list : undefined,
...(column.filter?.props || {}),
value: this.innerFilterValue?.[column.colKey],
};
if (column.colKey && this.innerFilterValue && column.colKey in this.innerFilterValue) {
filterComponentProps.value = this.innerFilterValue[column.colKey];
}
// 这个代码必须放在这里,没事儿别改
if (column.filter.type === 'single') {
filterComponentProps.onChange = (val: any) => {
Expand Down Expand Up @@ -141,13 +143,7 @@ export default defineComponent({
});
});
}
return (
<component
value={this.innerFilterValue?.[column.colKey]}
props={{ ...filterComponentProps }}
on={{ ...on }}
></component>
);
return <component props={{ ...filterComponentProps }} on={{ ...on }}></component>;
};

return (
Expand Down

0 comments on commit 8b50999

Please sign in to comment.