Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

441
Visualizações
Refreshing a vue component from a vue-router route

I have a view in my SPA that is loaded via vue router when a user types in a id in my sidebar. The component loads up and the prop is passed correctly through the route but if I type into the sidebar another id to load up I get this in console:

"vue-router.min.js:11 Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/mainreview/search?id=1560".

My search functionality is using push() from a axios request to confirm that id exists and returns that as an array then pushes the component:

router.push({ path: '/mainreview/search', query: { mmcid: this.id[0].ID } });

My route is as follows:

 { path: '/mainreview/search', component: mainreview, props: route => ({ id: route.query.id })}

Most posts I have found on here seem to recommend suppressing the error but in my case I want it to reload the component so that the mount function inside the component runs again which is what triggers my an axios call with all my data.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you only need an id and no other query param is needed, why don't just use it as url param?

{ 
    path: '/mainreview/search/:id', 
    component: mainreview, 
    props: true
}

Then you can push

router.push({ path: '/mainreview/search', params: { id: this.id[0].ID } });
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda