15
15
16
16
<script setup lang="ts">
17
17
import router from ' @/router'
18
- import { ref , watch } from ' vue'
18
+ import { nextTick , ref , watch } from ' vue'
19
19
import { ipc , store , track } from ' ./electron'
20
20
import { useAppStore } from ' ./store/app'
21
21
import { repository } from ' ../../package.json'
@@ -28,6 +28,7 @@ import {
28
28
emitter
29
29
} from ' @/composable'
30
30
import { createToast , destroyAllToasts } from ' vercel-toast'
31
+ import { useRoute } from ' vue-router'
31
32
32
33
// По какой то причине необходимо явно установить роут в '/'
33
34
// для корректного поведения в продакшен сборке
@@ -36,6 +37,7 @@ router.push('/')
36
37
37
38
const appStore = useAppStore ()
38
39
const snippetStore = useSnippetStore ()
40
+ const route = useRoute ()
39
41
40
42
const isUpdateAvailable = ref (false )
41
43
@@ -127,6 +129,17 @@ watch(
127
129
}
128
130
)
129
131
132
+ watch (
133
+ () => route .path ,
134
+ () => {
135
+ if (route .path === ' /' ) {
136
+ nextTick (() => {
137
+ emitter .emit (' scroll-to:snippet' , snippetStore .selectedId ! )
138
+ })
139
+ }
140
+ }
141
+ )
142
+
130
143
ipc .on (' main-menu:preferences' , () => {
131
144
router .push (' /preferences' )
132
145
})
0 commit comments