Skip to content

Commit

Permalink
fix: scroll to top when navigate (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
ydcjeff committed Jun 7, 2021
1 parent 2145a85 commit ea8e4b7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ const router = createRouter({
routes: routes,
scrollBehavior(to, from, savedPosition) {
if (to.hash) {
return {
el: to.hash,
behavior: 'smooth'
}
return { el: to.hash, behavior: 'smooth' }
}
return { top: 0, behavior: 'smooth' }
}
})

Expand Down

0 comments on commit ea8e4b7

Please sign in to comment.