Last active
August 18, 2023 09:19
-
-
Save laurisstepanovs/026f1e74ae345bed35d02880156d702c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setup() { | |
// your menu reference | |
const menuRef = ref<HTMLElement | null>(null); | |
onMounted(() => { | |
setTimeout(() => { | |
if (!menuRef.value) { | |
return; | |
} | |
// get menu instance | |
const inst = MenuComponent.getInstance(menuRef.value); | |
// create overlay element | |
let overlay = document.createElement("div"); | |
overlay.classList.add("drawer-overlay"); | |
overlay.style.zIndex = "104"; | |
overlay.style.display = "none"; | |
document.body.append(overlay); | |
// show event handler | |
inst?.on("kt.menu.dropdown.show", function () { | |
// show overlay | |
overlay.style.display = "block"; | |
}); | |
// hide event handler | |
inst?.on("kt.menu.dropdown.hide", function () { | |
// hide overlay | |
overlay.style.display = "none"; | |
}); | |
}, 10); | |
}); | |
return { | |
menuRef, | |
}; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment