Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

123
Vistas
No se pueden leer las propiedades de undefined (leyendo '$ set') vuejs

Así que estoy tratando de reordenar la matriz Documentos cuando se elimina un documento. Mi matriz de documentos se parece a esto:

 [ { "id": 1, "name": "document1" "document_number": 1, }, { "id": 30, "name": "document2" "document_number": 2, }, { "id": 4, "name": "document3" "document_number": 3, }, { "id": 4, "name": "document4" "document_number": 4, } ]

ahora, si el usuario elimina "document2", quiero cambiar reactivamente "document_number" para document3, document4 a "2", "3".

Lo que estoy intentando:

 reorderDocuments(document_number){ //filtering all documents that have "document_number" higher then the deleted document const filteredDocuments = this.Documents.filter(function (e) { return e.document_number > document_number; }); //the filtering works as intended so now I use a for loop to loop thru all those documents for(var i = 0; i < filteredDocuments.length; i++){ //here i am getting index of the document that i want to change this.index = this.Documents.findIndex(x => x.id === filteredDocuments[i].id); //the new number that should take place for document_number const newNumber = filteredDocuments[i].document_number - 1; //then im using $set to set that new number for the document //here is where i get an error this.Documents.document_number.$set(this.index, newNumber); } },

¿qué ocurre?

error:

 TypeError: Cannot read properties of undefined (reading '$set')
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

vm.$set o this.$set método de instancia, que es un alias para el Vue.set global. Generalmente lo usamos para establecer estados vuex . Por eso te recomiendo que uses

 this.Documents[this.index]. document_number = newNumber;
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda