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

136
Visualizações
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 Respostas
Responde à pergunta

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 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