title: Best way to get current route in Vue3 and Vue-router?
body: <p>I am trying to get the current path (something like <code>&quot;https://example.com/some/path&quot;</code>) with Vue3 and Vue-router.</p>
  <p>Before, when using Vue2, I could get the current route using:</p>
  <pre class="lang-js prettyprint-override"><code>    // works with vue 2.x with composition-api, but not with vue 3.x
      setup(_, ctx) {
          const path = computed(() =&gt; ctx.root.$route.path)
  </code></pre>
  <p>but in Vue3 it is not possible to use <code>ctx.root</code> (<a href="https://github.com/vuejs/vue-next/issues/1056" rel="noreferrer">as stated by Evan You here</a>).<br />
  So what is the preferred way to get the current route with Vue3?</p>