'How to set query parameters without reloading component in Vue with Vue-Router

I am trying to set the Query Parameters without reloading component in Vue with Vue-Router. But using below code it reloads the component:

this.$router.replace({query: this.filters});

How we can stop reload the component while changing the Query Parameters?



Solution 1:[1]

this.$router.replace({ ...this.$router.currentRoute, query: this.filters });

Going to the current path will not render the currently component again

Solution 2:[2]

According to @ManUtopiK you can use javascript's history API to accomplish this, check his answer here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pedrocate
Solution 2 João Pedro Domingues