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

132
Views
why does pushing an item into a data array not update the view/vuejs dev tools with the new data?

For some reason, pushing data into an array doesnt update the view/vue dev tools data. Why?

I have cleaned the browser cache without any luck.

theArray = [
   [
      {
         test: true
      }
   ]
]

methods: {
   addNewItem() {
     console.log(this.theArray[0].length); // = 1

     this.theArray[0].push({}); 

     console.log(this.theArray[0].length); // = 2. This does however show that the data was pushed but why do the view and vuejs tools not update/show the pushed data?
   }
}

However, doing this works for some reason?

this.theArray.push({}); 

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

That's due to Vue's reactivity. You can use Vue.set()/this.$set().

this.$set(theArray, 0, [ ...theArray[0], {} ]);

https://vuejs.org/v2/guide/reactivity.html#For-Arrays

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!