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 | import type { BasicColumn, BasicTableProps, CellFormat, GetColumnsParams } from '../types/table'; | 1 | import type { BasicColumn, BasicTableProps, CellFormat, GetColumnsParams } from '../types/table'; |
2 | import type { PaginationProps } from '../types/pagination'; | 2 | import type { PaginationProps } from '../types/pagination'; |
3 | import type { ComputedRef } from 'vue'; | 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 | import { renderEditCell } from '../components/editable'; | 5 | import { renderEditCell } from '../components/editable'; |
6 | import { usePermission } from '/@/hooks/web/usePermission'; | 6 | import { usePermission } from '/@/hooks/web/usePermission'; |
7 | import { useI18n } from '/@/hooks/web/useI18n'; | 7 | import { useI18n } from '/@/hooks/web/useI18n'; |
@@ -170,7 +170,7 @@ export function useColumns( | @@ -170,7 +170,7 @@ export function useColumns( | ||
170 | if ((edit || editRow) && !isDefaultAction) { | 170 | if ((edit || editRow) && !isDefaultAction) { |
171 | column.customRender = renderEditCell(column); | 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,12 +213,12 @@ export function useColumns( | ||
213 | if (!isString(firstColumn) && !isArray(firstColumn)) { | 213 | if (!isString(firstColumn) && !isArray(firstColumn)) { |
214 | columnsRef.value = columns as BasicColumn[]; | 214 | columnsRef.value = columns as BasicColumn[]; |
215 | } else { | 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 | const newColumns: BasicColumn[] = []; | 217 | const newColumns: BasicColumn[] = []; |
218 | cacheColumns.forEach((item) => { | 218 | cacheColumns.forEach((item) => { |
219 | newColumns.push({ | 219 | newColumns.push({ |
220 | ...item, | 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 | // Sort according to another array | 224 | // Sort according to another array |