Commit 4f9c711012b6db12d06b463a00f317b80cf7ad55
Committed by
GitHub
1 parent
12924fb3
fix: 修复BasicTable组件开启可编辑行卡顿/卡死问题 (#2939)
Showing
1 changed file
with
3 additions
and
3 deletions
src/components/Table/src/components/editable/index.ts
1 | 1 | import type { BasicColumn } from '/@/components/Table/src/types/table'; |
2 | 2 | |
3 | -import { h, Ref } from 'vue'; | |
3 | +import { h, Ref, toRaw } from 'vue'; | |
4 | 4 | |
5 | 5 | import EditableCell from './EditableCell.vue'; |
6 | 6 | import { isArray } from '/@/utils/is'; |
... | ... | @@ -13,7 +13,7 @@ interface Params { |
13 | 13 | |
14 | 14 | export function renderEditCell(column: BasicColumn) { |
15 | 15 | return ({ text: value, record, index }: Params) => { |
16 | - record.onValid = async () => { | |
16 | + toRaw(record).onValid = async () => { | |
17 | 17 | if (isArray(record?.validCbs)) { |
18 | 18 | const validFns = (record?.validCbs || []).map((fn) => fn()); |
19 | 19 | const res = await Promise.all(validFns); |
... | ... | @@ -23,7 +23,7 @@ export function renderEditCell(column: BasicColumn) { |
23 | 23 | } |
24 | 24 | }; |
25 | 25 | |
26 | - record.onEdit = async (edit: boolean, submit = false) => { | |
26 | + toRaw(record).onEdit = async (edit: boolean, submit = false) => { | |
27 | 27 | if (!submit) { |
28 | 28 | record.editable = edit; |
29 | 29 | } | ... | ... |