From e7dfb7e123e0a44c6b09b99df75f1ab507ea5c7e Mon Sep 17 00:00:00 2001 From: Jan Vennemann Date: Sun, 16 Dec 2018 03:57:58 +0100 Subject: [PATCH] fix: re-enable scroll to anchor behavior --- packages/@vuepress/core/lib/app/app.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/@vuepress/core/lib/app/app.js b/packages/@vuepress/core/lib/app/app.js index ef21209478..9d2a048540 100644 --- a/packages/@vuepress/core/lib/app/app.js +++ b/packages/@vuepress/core/lib/app/app.js @@ -66,8 +66,11 @@ export function createApp (isServer) { scrollBehavior (to, from, savedPosition) { if (savedPosition) { return savedPosition - } - if (to.path !== from.path) { + } else if (to.hash) { + return { + selector: to.hash + } + } else { return { x: 0, y: 0 } } }