title: How to add optional route in vue-router?
body: <p>I have a button like this:</p>
  
  <pre><code>&lt;router-link :to="{path: '/foo/bar', params: {id: 1}"&gt;
  </code></pre>
  
  <p>and my route for the above is defined in <code>route.js</code> file as:</p>
  
  <pre><code>...
  {
   path: 'foo/bar',
   component: fooComponent()
  }
  ...
  </code></pre>
  
  <p>Now, my question is how do I make my route accept a conditional url prop like <code>/foo/bar/1</code> and <code>/foo/bar</code> because now, it only accepts <code>/foo/bar</code></p>