Browse Source

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

tags/0.9.0
j 4 years ago
parent
commit
401751b816
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      vue-theme/src/router/index.js

+ 4
- 0
vue-theme/src/router/index.js View File

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])

Loading…
Cancel
Save