Reputation: 13
I have problem with vue-router-query I'm using a click event to navigate to filter page and append the URL query to it this is the sent query function in methods
search(){
this.$router.push({
name: 'query',
query: this.query
})
}
the ' this.query ' is the object that holds all query data so after I click the button and the method search runs he navigate to the filter page and this the URL localhost/query?data=1
now here is the problem I can't update the data
query if I want to add other element to the object the URL doesn't updated and here the filter page search method ,
updateSearchUrl(){
this.$router.push({
name: 'query',
query: this.query
})
}
It is the same but I can't under stand why it doesn't work but if I tried static data not a dynamic object it works so I'm kind stuck over here the problem in the this.$router.push
or from the object query
What I'm trying to do here is just to update the query URL and I tried a few solution and didn't work like this URL Click Here and also tried to use replace
instead of push
in $router
Upvotes: 0
Views: 2200
Reputation: 5992
Try this:
this.$router.push({
name: 'query',
query: Object.assign({}, this.query)
})
Upvotes: 2