]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix(scroll): change scrollRestoration if scrollBehavior is provided
authorEduardo San Martin Morote <posva13@gmail.com>
Sun, 10 May 2020 11:50:44 +0000 (13:50 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Sun, 10 May 2020 11:50:48 +0000 (13:50 +0200)
src/router.ts

index 4393d41ba6580539bc2b0b320d5fbd9120ad5fac..69b5b7fee2762231f4b03582a1962ed335b05b48 100644 (file)
@@ -176,7 +176,8 @@ export function createRouter(options: RouterOptions): Router {
   )
   let pendingLocation: RouteLocation = START_LOCATION_NORMALIZED
 
-  if (isBrowser && 'scrollRestoration' in history) {
+  // leave the scrollRestoration if no scrollBehavior is provided
+  if (isBrowser && scrollBehavior && 'scrollRestoration' in history) {
     history.scrollRestoration = 'manual'
   }