🐛(component): 修复cascader组件 children不能为空的问题

ISSUES CLOSED: #I5E4OM
This commit is contained in:
0o张不歪o0 2022-06-27 23:23:49 +08:00
parent 6648e99b96
commit fbe7688a83

View File

@ -174,7 +174,7 @@ function findData(orginData: any, level: number) {
const dataContainer = ref<any>([]);
const selectBar = (item: any, selectIndex: number, parentIndex: number) => {
treeData.value[parentIndex].selectIndex = selectIndex;
if (item.children) {
if (item.children && item.children.length > 0) {
treeData.value[parentIndex + 1].selectIndex = null;
treeData.value[parentIndex + 1].data = findData(item.children, 1);
}