Reputation: 177
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?
Upvotes: 10
Views: 4735
Reputation: 144
The following solution works for me in vue2. You can try it...
this.$router.push({name: this.$route.name, query: this.filters});
Upvotes: 0
Reputation: 144
this.$router.replace({ ...this.$router.currentRoute, query: this.filters });
Going to the current path will not render the currently component again
Upvotes: 4
Reputation: 106
According to @ManUtopiK you can use javascript's history API to accomplish this, check his answer here.
Upvotes: 0