fix: 修复BasicTable组件开启可编辑行卡顿/卡死问题 (#2939)
This commit is contained in:
parent
12924fb3fa
commit
4f9c711012
|
|
@ -1,6 +1,6 @@
|
|||
import type { BasicColumn } from '/@/components/Table/src/types/table';
|
||||
|
||||
import { h, Ref } from 'vue';
|
||||
import { h, Ref, toRaw } from 'vue';
|
||||
|
||||
import EditableCell from './EditableCell.vue';
|
||||
import { isArray } from '/@/utils/is';
|
||||
|
|
@ -13,7 +13,7 @@ interface Params {
|
|||
|
||||
export function renderEditCell(column: BasicColumn) {
|
||||
return ({ text: value, record, index }: Params) => {
|
||||
record.onValid = async () => {
|
||||
toRaw(record).onValid = async () => {
|
||||
if (isArray(record?.validCbs)) {
|
||||
const validFns = (record?.validCbs || []).map((fn) => fn());
|
||||
const res = await Promise.all(validFns);
|
||||
|
|
@ -23,7 +23,7 @@ export function renderEditCell(column: BasicColumn) {
|
|||
}
|
||||
};
|
||||
|
||||
record.onEdit = async (edit: boolean, submit = false) => {
|
||||
toRaw(record).onEdit = async (edit: boolean, submit = false) => {
|
||||
if (!submit) {
|
||||
record.editable = edit;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue