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

160
Views
Calling function shortly after page load, once results are received from controller

I'm trying to call a computed property (which relies on a data variable to be set from incoming json) upon page creation but it says that it can't read the data for 'undefined'. This is due to the data I need not being fully loaded, I'm pretty sure. When I set it to run 2 seconds after created(), it works just fine.

How can I neatly set this to only run the function on my data variable one time but ONLY once the data results are actually set?

<div id="app">
  <div v-for="(value, employee) in employeeFunction" :key="employee">
    @{{value}}
  </div>
</div>


<script>

var vm = 
new Vue({
  el: "#app",

  data: {

    results: [
        {//data is in here

        }
    ],

  },
  created: function(){
    this.interval = setInterval(() => this.employeeFunction(), 2000);
  },
  computed: {

    employeeFunction() {
      console.log('employee data')
      employeeResults = this.results
      console.log(employeeResults)
      return employeeResults
    },

    
  }
});
</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Instead of using the created() lifecycle-hook try with mounted()

about 4 years ago · Juan Pablo Isaza 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!