]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: improve scroll-behavior.md (#522) [skip ci]
authorMostafa Salama <mostafatourad789@gmail.com>
Sun, 11 Oct 2020 11:00:37 +0000 (13:00 +0200)
committerGitHub <noreply@github.com>
Sun, 11 Oct 2020 11:00:37 +0000 (13:00 +0200)
fixing the syntax in scroll behavior function, the `el: '#main'` should be in a comment and the element **el** should be in the return object

docs/guide/advanced/scroll-behavior.md

index 148247e0486074b0e8f1f01e08ad1ed0db87e616..7063f2653df762cb3b1d02f6527bc0291a69c7c9 100644 (file)
@@ -35,10 +35,10 @@ You can also pass a CSS selector or a DOM element via `el`. In that scenario, `t
 const router = createRouter({
   scrollBehavior (to, from, savedPosition) {
     // always scroll 10px above the element #main
-    el: '#main',
+    // el: '#main'
     // could also be
     // el: document.getElementById('main'),
-    return { top: -10 }
+    return { el: '#main',  top: -10 }
   }
 })
 ```