I have a <search-bar> component that have some dropdown that i will use as filter search. When I press the submit button i run the following code:
search() {
let query = {
status: this.selectedOrderStatus
};
this.$router.push({ path: '/', query: query })
}
This will chage my url as: http://localhost:8080?status=1 or http://localhost:8080?status=2 and its ok.
In another component (that is the / component) i have place a watch to handle url change, like this:
watch: {
'$route': 'loadOrders'
},
So, when in my dropdown i choice a value, the component is reloaded.
But, if i'm on url http://localhost:8080?status=1 and i press submit button nothing happen. I have to choice another value (for example 2) to make the reload.
How i can handle the reload every time i press the submit button? Because, i would like to press "Submit" again, using the same parameter.