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
pull/6524/head
Zev Zhu 2023-05-03 13:30:26 +08:00 committed by GitHub
parent 3b37cc1ae7
commit 045193e797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -86,12 +86,9 @@ export default defineComponent({
const titleClick = (e: Event) => { const titleClick = (e: Event) => {
console.log('titleClick', e); console.log('titleClick', e);
}; };
watch( watch(openKeys, val => {
() => openKeys, console.log('openKeys', val);
val => { });
console.log('openKeys', val);
},
);
return { return {
selectedKeys, selectedKeys,
openKeys, openKeys,

View File

@ -37,7 +37,7 @@ function fillSlots<RecordType>(columns: ColumnsType<RecordType>, contextSlots: R
() => [column.title as any], () => [column.title as any],
); );
} }
if ('children' in cloneColumn) { if ('children' in cloneColumn && Array.isArray(cloneColumn.children)) {
cloneColumn.children = fillSlots(cloneColumn.children, contextSlots); cloneColumn.children = fillSlots(cloneColumn.children, contextSlots);
} }