Skip to content

Commit 864afb1

Browse files
committed
fix(devtools): update scroll position on change route
1 parent 332362a commit 864afb1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/renderer/views/Devtools.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<script setup lang="ts">
2+
import type { PerfectScrollbarExpose } from 'vue3-perfect-scrollbar'
23
import { i18n } from '@/electron'
34
import { router, RouterName } from '@/router'
45
import { useRoute } from 'vue-router'
56
67
const route = useRoute()
8+
const scrollRef = useTemplateRef<PerfectScrollbarExpose>('scrollRef')
79
810
const isActiveRoute = computed(() => {
911
return (name: string) => route.name === name
@@ -88,6 +90,15 @@ const generatorsNav = [
8890
name: RouterName.devtoolsLoremIpsumGenerator,
8991
},
9092
]
93+
94+
watch(
95+
() => route.name,
96+
() => {
97+
nextTick(() => {
98+
scrollRef.value?.ps?.update()
99+
})
100+
},
101+
)
91102
</script>
92103

93104
<template>
@@ -160,6 +171,7 @@ const generatorsNav = [
160171
</template>
161172
<template #right>
162173
<PerfectScrollbar
174+
ref="scrollRef"
163175
class="h-full px-5 pb-5"
164176
:options="{ minScrollbarLength: 20 }"
165177
>

0 commit comments

Comments
 (0)