You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
698 B
29 lines
698 B
import { computed } from 'vue';
|
|
|
|
function useMenu(instance, currentIndex) {
|
|
const indexPath = computed(() => {
|
|
let parent = instance.parent;
|
|
const path = [currentIndex.value];
|
|
while (parent.type.name !== "ElMenu") {
|
|
if (parent.props.index) {
|
|
path.unshift(parent.props.index);
|
|
}
|
|
parent = parent.parent;
|
|
}
|
|
return path;
|
|
});
|
|
const parentMenu = computed(() => {
|
|
let parent = instance.parent;
|
|
while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
|
|
parent = parent.parent;
|
|
}
|
|
return parent;
|
|
});
|
|
return {
|
|
parentMenu,
|
|
indexPath
|
|
};
|
|
}
|
|
|
|
export { useMenu as default };
|
|
//# sourceMappingURL=use-menu.mjs.map
|
|
|