We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f33f797 commit 3699db8Copy full SHA for 3699db8
1 file changed
app/app.vue
@@ -1,4 +1,6 @@
1
<script setup lang="ts">
2
+import { useEventListener } from '@vueuse/core'
3
+
4
const route = useRoute()
5
const router = useRouter()
6
@@ -38,13 +40,9 @@ function handleGlobalKeydown(e: KeyboardEvent) {
38
40
}
39
41
42
-onMounted(() => {
- document.addEventListener('keydown', handleGlobalKeydown)
43
-})
44
-
45
-onUnmounted(() => {
46
- document.removeEventListener('keydown', handleGlobalKeydown)
47
+if (import.meta.client) {
+ useEventListener(document, 'keydown', handleGlobalKeydown)
+}
48
</script>
49
50
<template>
0 commit comments