D
D
Daria It doesn't matter2021-07-22 13:44:41
Vue.js
Daria It doesn't matter, 2021-07-22 13:44:41

Why is the vue router route not working?

Hello!
Faced a problem
, there is a product card component that is located on such a route

{
    path: '/product/*/:option?',
    name: 'product',
    component: () => import(/* webpackChunkName: "Product" */ '../views/ProductCard')
  },

this component has a block with recommended products
this block has a router-link that follows the same route as the component itself, when you click on the recommended product, the url changes to the correct one, but nothing happens and the component remains with the old product , what could be the problem ? in advance thx path: '/product/*/:option?'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2021-09-03
@nbrylevv

If I understand your question correctly, then you need to call the method to update the product data when the option parameter in the route changes

{
// ...
watch: {
   'route.params.option'(value) {
      this.updateCard();
   },
},
// ...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question