title: Vue Router save scroll position on a route and go back to that position when navigating back?
body: <p>I'm using Vue Router and scrollBehavior and each route still loads a the top of the page (0,0), rather than remembering my scroll position. Thoughts on what I'm missing?</p>
  <p>Here's my router code:</p>
  <pre><code>const scrollBehavior = (to, from, savedPosition) =&gt; {
    if (savedPosition) {
      return savedPosition;
    } else {
      return { x: 0, y: 0 };
    }
  };
  const router = new VueRouter({
    mode: &quot;history&quot;,
    base: process.env.BASE_URL,
    routes,
    scrollBehavior,
  });
  </code></pre>