From 601368921f075aa1870d1c3ce8f4a8330260206a Mon Sep 17 00:00:00 2001 From: Vben <anncwb@126.com> Date: 星期三, 24 二月 2021 23:31:39 +0800 Subject: [PATCH] fix(table): get the selected rows of the table correctly --- src/components/Table/src/hooks/useTable.ts | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/Table/src/hooks/useTable.ts b/src/components/Table/src/hooks/useTable.ts index 634da3f..478b66a 100644 --- a/src/components/Table/src/hooks/useTable.ts +++ b/src/components/Table/src/hooks/useTable.ts @@ -3,7 +3,7 @@ import type { DynamicProps } from '/@/types/utils'; import { getDynamicProps } from '/@/utils'; -import { ref, onUnmounted, unref, watch } from 'vue'; +import { ref, onUnmounted, unref, watch, toRaw } from 'vue'; import { isProdMode } from '/@/utils/env'; import { isInSetup } from '/@/utils/helper/vueHelper'; import { error } from '/@/utils/log'; @@ -77,11 +77,11 @@ getTableInstance().setLoading(loading); }, getDataSource: () => { - return getTableInstance().getDataSource(); + return toRaw(getTableInstance().getDataSource()); }, getColumns: ({ ignoreIndex = false }: { ignoreIndex?: boolean } = {}) => { const columns = getTableInstance().getColumns({ ignoreIndex }) || []; - return columns; + return toRaw(columns); }, setColumns: (columns: BasicColumn[]) => { getTableInstance().setColumns(columns); @@ -96,10 +96,10 @@ getTableInstance().deleteSelectRowByKey(key); }, getSelectRowKeys: () => { - return getTableInstance().getSelectRowKeys(); + return toRaw(getTableInstance().getSelectRowKeys()); }, getSelectRows: () => { - return getTableInstance().getSelectRows(); + return toRaw(getTableInstance().getSelectRows()); }, clearSelectedRowKeys: () => { getTableInstance().clearSelectedRowKeys(); @@ -111,16 +111,16 @@ return getTableInstance().getPaginationRef(); }, getSize: () => { - return getTableInstance().getSize(); + return toRaw(getTableInstance().getSize()); }, updateTableData: (index: number, key: string, value: any) => { return getTableInstance().updateTableData(index, key, value); }, getRowSelection: () => { - return getTableInstance().getRowSelection(); + return toRaw(getTableInstance().getRowSelection()); }, getCacheColumns: () => { - return getTableInstance().getCacheColumns(); + return toRaw(getTableInstance().getCacheColumns()); }, getForm: () => { return (unref(formRef) as unknown) as FormActionType; @@ -129,7 +129,7 @@ getTableInstance().setShowPagination(show); }, getShowPagination: () => { - return getTableInstance().getShowPagination(); + return toRaw(getTableInstance().getShowPagination()); }, }; -- Gitblit v1.8.0