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

124
Visualizações
caching scroll position on a VUE 3 application

I have a problem with my Vue application. it is a big application with over 40 pages. The problem is sometimes the browser caches the scroll position so when the user moves from a page to another, browser shows the scroll position of the previous page. Which hides the top page content from a user who needs to scroll up to see the full content. This is bad for the user experience.

I found a solution here but it needs to copy/paste in all the 40 pages views which is not very smart. Any better solutions

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

0

Well, using the helpful answer in the linked answer but much more smart, I found a grat method of router called afterEach here is how:


router.afterEach((to, from) => {
 
  window.scrollTo(0, 0);
});

by this code, whenever route changes, the window will scroll back to the top left corner of the browser preventing any cached scroll position and providing a better user experience

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