Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

537
Views
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 answers
Answer question

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 Report

0

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

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!