Przeglądaj źródła

:sparkles: address #77 | adding scroll to top router guard

tags/0.9.0
j 4 lat temu
rodzic
commit
401751b816
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4
    0
      vue-theme/src/router/index.js

+ 4
- 0
vue-theme/src/router/index.js Wyświetl plik

10
 
10
 
11
 router.beforeEach((to, from, next) => {
11
 router.beforeEach((to, from, next) => {
12
     document.title = 'Craft in America'
12
     document.title = 'Craft in America'
13
+
14
+    // Scroll to top
15
+    window.scrollTo(0, 0)
16
+
13
     // Append list type
17
     // Append list type
14
     if (to.path.split('/').length > 1 && to.path.split('/')[1]) {
18
     if (to.path.split('/').length > 1 && to.path.split('/')[1]) {
15
         const path = convertTitleCase(to.path.split('/')[1])
19
         const path = convertTitleCase(to.path.split('/')[1])

Ładowanie…
Anuluj
Zapisz