Skip to content

Commit

Permalink
fix(menu): calc nest or not correctly (#916)
Browse files Browse the repository at this point in the history
* fix(menu): calc nest or not correctly

* test(menu): resolve errors
  • Loading branch information
LeeJim authored Jun 1, 2022
1 parent d29bfd7 commit ce267d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/menu/submenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,15 @@ export default defineComponent({
onMounted(() => {
menu?.vMenu?.add({ value: props.value, parent: submenu?.value, vnode: ctx.slots.default });
const instance = getCurrentInstance();
let node = instance.parent;

isNested.value = !/^t(head)?menu/i.test(instance.parent?.type.name);
while (node && !/^t(head)?menu/i.test(node?.type.name)) {
if (/submenu/i.test(node?.type.name)) {
isNested.value = true;
break;
}
node = node?.parent;
}
});

return {
Expand Down

0 comments on commit ce267d4

Please sign in to comment.