Преглед на файлове

fix(table component): reduce 'insertTableDataRecord' code logic (#1536)

George Tan преди 3 години
родител
ревизия
de8ea59177
променени са 1 файла, в които са добавени 2 реда и са изтрити 3 реда
  1. 2 3
      src/components/Table/src/hooks/useDataSource.ts

+ 2 - 3
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) {