Commit e78af6f228e25f052dc4c5a1859a6db50e0b112e
1 parent
4ae39c53
fix(table): getDataSource not worked on empty data
修复getDataSource获取的数据源在表格为空时返回值错误的问题。 fixed: #752
Showing
2 changed files
with
3 additions
and
1 deletions
CHANGELOG.zh_CN.md
@@ -5,6 +5,8 @@ | @@ -5,6 +5,8 @@ | ||
5 | - **Table** 修复分页抖动问题 | 5 | - **Table** 修复分页抖动问题 |
6 | - **Upload** 确保携带自定义参数 | 6 | - **Upload** 确保携带自定义参数 |
7 | - **Dropdown** 修复 popConfirm 的图标显示问题 | 7 | - **Dropdown** 修复 popConfirm 的图标显示问题 |
8 | +- **Table** 修复树形表格的编辑事件不正常的问题 | ||
9 | +- **Table** 修复当表格数据为空时,getDataSource 返回的值不是表格所使用的数据源的问题 | ||
8 | 10 | ||
9 | ## 2.5.0(2021-06-20) | 11 | ## 2.5.0(2021-06-20) |
10 | 12 |
src/components/Table/src/hooks/useDataSource.ts
@@ -113,7 +113,7 @@ export function useDataSource( | @@ -113,7 +113,7 @@ export function useDataSource( | ||
113 | const getDataSourceRef = computed(() => { | 113 | const getDataSourceRef = computed(() => { |
114 | const dataSource = unref(dataSourceRef); | 114 | const dataSource = unref(dataSourceRef); |
115 | if (!dataSource || dataSource.length === 0) { | 115 | if (!dataSource || dataSource.length === 0) { |
116 | - return []; | 116 | + return unref(dataSourceRef); |
117 | } | 117 | } |
118 | if (unref(getAutoCreateKey)) { | 118 | if (unref(getAutoCreateKey)) { |
119 | const firstItem = dataSource[0]; | 119 | const firstItem = dataSource[0]; |