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) => { watch(modelValue, async (v) => {
if (v) { if (v) {
isOut = true isOut = true
@ -85,8 +87,14 @@ watch(modelValue, async (v) => {
setTimeout(() => { setTimeout(() => {
isOut = false isOut = false
}, 10) }, 10)
unsubscribe = useRouter().beforeEach(() => {
unsubscribe()
close()
})
} }
else { else {
unsubscribe?.()
isOut = true isOut = true
} }
}) })