title: Conditional route in Vue.js
body: <p>I have two different views that I'd like to show for the same path depending on whether a token is in LocalStorage or not. I could move the logic directly into the view itself, but I was curious to know whether there's a way to it in the Router.</p>
  
  <p>Something like:</p>
  
  <pre><code>export default new Router({
    mode: "history",
    base: process.env.BASE_URL,
    routes: [
      {
        path: "/",
        name: "home",
        component: function() {
          if (...) {
            return ViewA
          } else {
            return ViewB
          }
        }
      },
    ]
  });
  </code></pre>
  
  <p>I tried with the above code but didn't work. The app builds fine but none of the two views is shown.</p>