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

231
Views
Error de Vue.js: TypeError: no se pueden leer las propiedades de undefined

Mi conocimiento de vue.js es limitado pero, por lo que sé, esto debería funcionar, por alguna razón, cuando intento acceder a mi variable en la propiedad de datos, no puedo encontrarla.

ingrese la descripción de la imagen aquí

 data: function() { return { id: 0, clients: [] } }, methods: { getClientData(){ fetch('/view-clients/' + this.id).then(function (response) { return response.text(); }).then(function (data) { this.clients = JSON.parse(data); this.id = this.clients[clients.length - 1].id; }).catch(function (error) { console.log('Error: ' + error); }); } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El alcance de la función es probablemente el culpable. En su lugar, use funciones de flecha para que this se refiera al componente Vue.

 data() { return { id: 0, clients: [] } }, methods: { getClientData(){ fetch('/view-clients/' + this.id).then((response) => response.text()) .then((data) => { this.clients = JSON.parse(data); this.id = this.clients[this.clients.length - 1].id; }).catch((error) => { console.log('Error: ' + error); }); } }
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!