9

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?

Smit Patel
  • 167
  • 1
  • 8
  • Can you add more context to your question, like how is your router structured. How does you router view look like, how does the component you are calling it from look like, some snippets related to these. Your issue can be caused by a number of factors, like keying on components or router-view itself etc, until then I do not think that anyone can solve your exact problem :D – Komi Dec 13 '21 at 15:29

2 Answers2

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

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

Pedrocate
  • 124
  • 1
  • 5
-1

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