Commit 5c2735346745cf91aa9812a0afbf62e4625faf40
1 parent
e821f4c7
fix(table): restore the property of the table
Showing
5 changed files
with
12 additions
and
9 deletions
CHANGELOG.zh_CN.md
src/components/Table/src/hooks/useColumns.ts
... | ... | @@ -43,19 +43,17 @@ function handleIndexColumn( |
43 | 43 | getPaginationRef: ComputedRef<boolean | PaginationProps>, |
44 | 44 | columns: BasicColumn[] |
45 | 45 | ) { |
46 | - const { showIndexColumn, indexColumnProps } = unref(propsRef); | |
46 | + const { showIndexColumn, indexColumnProps, isTreeTable } = unref(propsRef); | |
47 | 47 | |
48 | 48 | let pushIndexColumns = false; |
49 | - columns.forEach((item) => { | |
50 | - const { children } = item; | |
51 | - | |
52 | - const isTreeTable = children && children.length; | |
53 | - | |
49 | + if (unref(isTreeTable)) { | |
50 | + return; | |
51 | + } | |
52 | + columns.forEach(() => { | |
54 | 53 | const indIndex = columns.findIndex((column) => column.flag === INDEX_COLUMN_FLAG); |
55 | - | |
56 | - if (showIndexColumn && !isTreeTable) { | |
54 | + if (showIndexColumn) { | |
57 | 55 | pushIndexColumns = indIndex === -1; |
58 | - } else if (!showIndexColumn && !isTreeTable && indIndex !== -1) { | |
56 | + } else if (!showIndexColumn && indIndex !== -1) { | |
59 | 57 | columns.splice(indIndex, 1); |
60 | 58 | } |
61 | 59 | }); | ... | ... |
src/components/Table/src/props.ts
... | ... | @@ -16,6 +16,8 @@ import { propTypes } from '/@/utils/propTypes'; |
16 | 16 | export const basicProps = { |
17 | 17 | clickToRowSelect: propTypes.bool.def(true), |
18 | 18 | |
19 | + isTreeTable: propTypes.bool.def(false), | |
20 | + | |
19 | 21 | tableSetting: { |
20 | 22 | type: Object as PropType<TableSetting>, |
21 | 23 | }, | ... | ... |
src/components/Table/src/types/table.ts