Commit 4a4321a77d0cd08c4aaca94ebac16da310ed23c4
Committed by
GitHub
1 parent
aee08b14
fix: 修改表格的resizeColumn事件的回调函数中,修改列宽度无效的bug (vbenjs#2073) (#2081)
Co-authored-by: wjc <7098544231@qq.com>
Showing
1 changed file
with
4 additions
and
4 deletions
src/components/Table/src/hooks/useColumns.ts
1 | 1 | import type { BasicColumn, BasicTableProps, CellFormat, GetColumnsParams } from '../types/table'; |
2 | 2 | import type { PaginationProps } from '../types/pagination'; |
3 | 3 | import type { ComputedRef } from 'vue'; |
4 | -import { computed, Ref, ref, toRaw, unref, watch } from 'vue'; | |
4 | +import { computed, Ref, ref, reactive, toRaw, unref, watch } from 'vue'; | |
5 | 5 | import { renderEditCell } from '../components/editable'; |
6 | 6 | import { usePermission } from '/@/hooks/web/usePermission'; |
7 | 7 | import { useI18n } from '/@/hooks/web/useI18n'; |
... | ... | @@ -170,7 +170,7 @@ export function useColumns( |
170 | 170 | if ((edit || editRow) && !isDefaultAction) { |
171 | 171 | column.customRender = renderEditCell(column); |
172 | 172 | } |
173 | - return column; | |
173 | + return reactive(column); | |
174 | 174 | }); |
175 | 175 | }); |
176 | 176 | |
... | ... | @@ -213,12 +213,12 @@ export function useColumns( |
213 | 213 | if (!isString(firstColumn) && !isArray(firstColumn)) { |
214 | 214 | columnsRef.value = columns as BasicColumn[]; |
215 | 215 | } else { |
216 | - const columnKeys = (columns as (string | string[])[]).map(m => m.toString()); | |
216 | + const columnKeys = (columns as (string | string[])[]).map((m) => m.toString()); | |
217 | 217 | const newColumns: BasicColumn[] = []; |
218 | 218 | cacheColumns.forEach((item) => { |
219 | 219 | newColumns.push({ |
220 | 220 | ...item, |
221 | - defaultHidden: !columnKeys.includes(item.dataIndex?.toString() || (item.key as string)) | |
221 | + defaultHidden: !columnKeys.includes(item.dataIndex?.toString() || (item.key as string)), | |
222 | 222 | }); |
223 | 223 | }); |
224 | 224 | // Sort according to another array |
... | ... |