From f82bde9d1c9ce41a1904ae8c660e74c5b46325ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Tue, 27 Dec 2016 14:53:14 +0100 Subject: [PATCH] Add scrollToTop option --- lib/app/router.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/app/router.js b/lib/app/router.js index e603f68cb4..a85f2d5925 100644 --- a/lib/app/router.js +++ b/lib/app/router.js @@ -35,6 +35,9 @@ const scrollBehavior = (to, from, savedPosition) => { if (to.matched.length < 2) { position = { x: 0, y: 0 } } + else if (to.matched.some((r) => r.components.default.scrollToTop || (r.components.default.options && r.components.default.options.scrollToTop))) { + position = { x: 0, y: 0 } + } // if link has anchor, scroll to anchor by returning the selector if (to.hash) { position = { selector: to.hash }