Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 549
Smit Patel Avatar asked Apr 28 '20 14:04

Smit Patel


1 Answers

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

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

like image 154
Pedrocate Avatar answered Sep 21 '22 14:09

Pedrocate