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

543
Visualizações
Is there a way to hook in to page reload in Nuxt?

I have an issue where I need to call a function every time the user reloads the page. Normally this would work by just using the created hook on App.vue, but since this project autogenerates the base component I'm not able to do this here.

I don't want to call this function when the user is navigating between routes, only when the page is reloaded/refreshed.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I think that you do have not many options here, as far as I can see, because we can know that the page has been refreshed only from the browser, which means that you need to find a cross-browser solution.

Vue way: But you could keep this component alive and execute your code in created hook, and the code that should be executed when route changes is executed in route change hooks (beforeRouteEnter, etc.).

JS way: I suppose to think that PerformanceNavigationTiming API is the right what you need. Here you can find a detailed description of this method.

P.S. - Pay attention to browser support and that a lot of people use Apple devices.

over 4 years ago · Santiago Trujillo Relatório

0

You can call it in a beforeMount() in the default layout.

over 4 years ago · Santiago Trujillo 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