From 045193e797b9f0c453e249844dd9e8da264ed628 Mon Sep 17 00:00:00 2001 From: Zev Zhu <45655660+aibayanyu20@users.noreply.github.com> Date: Wed, 3 May 2023 13:30:26 +0800 Subject: [PATCH] fix: passing a non-array as children to a table will result in an error. (#6521) * fix: fix table column data is passed into chlidren is undefined or null errorr * chore(menu): fix menu inline demo watch not trigger --- components/menu/demo/inline.vue | 9 +++------ components/table/hooks/useColumns.tsx | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/components/menu/demo/inline.vue b/components/menu/demo/inline.vue index fcfdbb831..86e600db4 100644 --- a/components/menu/demo/inline.vue +++ b/components/menu/demo/inline.vue @@ -86,12 +86,9 @@ export default defineComponent({ const titleClick = (e: Event) => { console.log('titleClick', e); }; - watch( - () => openKeys, - val => { - console.log('openKeys', val); - }, - ); + watch(openKeys, val => { + console.log('openKeys', val); + }); return { selectedKeys, openKeys, diff --git a/components/table/hooks/useColumns.tsx b/components/table/hooks/useColumns.tsx index 8aed4d259..aab022e25 100644 --- a/components/table/hooks/useColumns.tsx +++ b/components/table/hooks/useColumns.tsx @@ -37,7 +37,7 @@ function fillSlots(columns: ColumnsType, contextSlots: R () => [column.title as any], ); } - if ('children' in cloneColumn) { + if ('children' in cloneColumn && Array.isArray(cloneColumn.children)) { cloneColumn.children = fillSlots(cloneColumn.children, contextSlots); }