From de8ea591775f172eb6caa1ef72d827c903250f80 Mon Sep 17 00:00:00 2001 From: George Tan <406132614@qq.com> Date: Tue, 28 Dec 2021 18:45:32 +0800 Subject: [PATCH] fix(table component): reduce 'insertTableDataRecord' code logic (#1536) --- src/components/Table/src/hooks/useDataSource.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/Table/src/hooks/useDataSource.ts b/src/components/Table/src/hooks/useDataSource.ts index cba5b307..698b199a 100644 --- a/src/components/Table/src/hooks/useDataSource.ts +++ b/src/components/Table/src/hooks/useDataSource.ts @@ -196,11 +196,10 @@ export function useDataSource( } function insertTableDataRecord(record: Recordable, index: number): Recordable | undefined { - if (!dataSourceRef.value || dataSourceRef.value.length == 0) return; + // if (!dataSourceRef.value || dataSourceRef.value.length == 0) return; index = index ?? dataSourceRef.value?.length; unref(dataSourceRef).splice(index, 0, record); - unref(propsRef).dataSource?.splice(index, 0, record); - return unref(propsRef).dataSource; + return unref(dataSourceRef); } function findTableDataRecord(rowKey: string | number) {