From e78af6f228e25f052dc4c5a1859a6db50e0b112e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=A0=E6=9C=A8?= Date: Fri, 25 Jun 2021 15:08:43 +0800 Subject: [PATCH] fix(table): getDataSource not worked on empty data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复getDataSource获取的数据源在表格为空时返回值错误的问题。 fixed: #752 --- CHANGELOG.zh_CN.md | 2 ++ src/components/Table/src/hooks/useDataSource.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 253b6069fb3..259b3e62909 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -5,6 +5,8 @@ - **Table** 修复分页抖动问题 - **Upload** 确保携带自定义参数 - **Dropdown** 修复 popConfirm 的图标显示问题 +- **Table** 修复树形表格的编辑事件不正常的问题 +- **Table** 修复当表格数据为空时,getDataSource 返回的值不是表格所使用的数据源的问题 ## 2.5.0(2021-06-20) diff --git a/src/components/Table/src/hooks/useDataSource.ts b/src/components/Table/src/hooks/useDataSource.ts index 1f9aec4e540..7c8d887e2dc 100644 --- a/src/components/Table/src/hooks/useDataSource.ts +++ b/src/components/Table/src/hooks/useDataSource.ts @@ -113,7 +113,7 @@ export function useDataSource( const getDataSourceRef = computed(() => { const dataSource = unref(dataSourceRef); if (!dataSource || dataSource.length === 0) { - return []; + return unref(dataSourceRef); } if (unref(getAutoCreateKey)) { const firstItem = dataSource[0];