0👍
You will have to add a befoureRouteUpdate(to, from, next)
hook in your component – or a watcher on $route
. Vue-Router reuses the same component because you are not changing the route – only the query parameters.
Keep in mind that:
- the
beforeRouteUpdate
will be called only when the component is being reused – not when the route is visited for the first time (for the latter you needbeforeRouteEnter
) - the watcher will be also called when you leave the route (e.g. if you go to
clients
page)
Source:stackexchange.com