K
K
KoRNeT46RuS2019-12-11 11:28:55
Vue.js
KoRNeT46RuS, 2019-12-11 11:28:55

Why doesn't beforeRouteUpdate work when switching to another route?

I have 2 routes that refer to the same component

routes: [
        {path: '/catalog/find', name: 'find', component: catalog_category},
        {path: '/catalog/*', name: 'funcGroup', component: catalog_category},
    ]

When I run on the second route, the function in beforeRouteUpdate fulfills and updates the data on the page without reloading. There is a filter on this route, in which, when you click on the button, after certain actions, a transition to another route is triggered
this.$router.push({ name: 'find', query: parameters});

The trick is that the route changes in the browser (the link becomes different), but it doesn’t even enter beforeRouteUpdate. The question is why and how can I update the data in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2019-12-11
@KoRNeT46RuS

You need to use beforeRouteEnter since you have the same component.
https://github.com/vuejs/vue-router/issues/1875

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question