[Vuejs]-How to change current route in vue-router

3👍

The path you’ve supplied to the <router-link> is a relative path. You need to prefix the path with a / so that it is relative to the root of the website, rather than the current page:

<router-link
        :to="{ path: `/homes/${this.$route.params.search}/rent/` }"
        tag="p"
      >
        Rent
</router-link>

0👍

you need to add a / before homes to make it an absolute path. please try with the below code.

<router-link
    :to="{ path: `/homes/${this.$route.params.search}/rent/` }"
    tag="p"
  >
    Rent
</router-link>

Leave a comment