1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-07 01:19:57 +00:00

fix(ui): close modals when navigating (#253)

This commit is contained in:
Daniel Roe 2022-11-30 10:27:50 +00:00 committed by GitHub
parent fc38c339a6
commit 1039c225e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,6 +78,8 @@ useEventListener('keydown', (e: KeyboardEvent) => {
}
})
let unsubscribe: () => void
watch(modelValue, async (v) => {
if (v) {
isOut = true
@ -85,8 +87,14 @@ watch(modelValue, async (v) => {
setTimeout(() => {
isOut = false
}, 10)
unsubscribe = useRouter().beforeEach(() => {
unsubscribe()
close()
})
}
else {
unsubscribe?.()
isOut = true
}
})