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

zio/stable
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
1 changed files with 8 additions and 0 deletions

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
}
})