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

254
Views
TypeError: no se pueden leer las propiedades de nulo (leyendo 'subTree')

¿Qué significa este error?

mensaje de error

esto sucede cuando pongo mi variable filteredData dentro de la etiqueta tr de la tabla.

 <table id="table"> <tr> <th>First name</th> <th>Last Name</th> <th>Email</th> <th>Original email</th> <th>Actions</th> </tr> <template> <tr v-if="(fiteredData = '')"> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr v-else v-for="data in filteredData" :key="data.ind_id" :value="data.ind_id" > <td>{{ data.first_name }}</td> <td>{{ data.last_name }}</td> <td>{{ data.email }}</td> <td>{{ data.email }}</td> <td> <button @click="sendProps(data)"> <i class="fa-regular fa-edit" aria-hidden="true"></i> </button> </td> </tr> </template> </table>

Este es mi método:

 data() { return { fetchedData: "", filteredData: "", }; }, methods: { searchResult(e) { this.filteredData = this.fetchedData.filter((data) => { return data.email.toLowerCase().includes(this.email.toLowerCase()); }); e.preventDefault(); console.log(this.filteredData); }

fetchedData obtener los datos de esto:

 async mounted() { await axios.get("http://localhost:5000/individuals").then((result) => { this.fetchedData = result.data; console.log(this.fetchedData); }); },
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Supongo que esto: <tr v-if="(filteredData = '')"> debería ser: <tr v-if="filteredData === ''"> , o incluso mejor: v-if="!filteredData.length" . Ha escrito mal el nombre de la variable y accidentalmente lo está configurando en una cadena vacía en lugar de hacer una comparación (todos hemos estado allí, estoy seguro)

En una nota relacionada, inicializaría fetchedData y filteredData como matrices vacías, no cadenas, porque v-for está destinado a iterar sobre objetos y matrices, no cadenas (aunque probablemente sea lo suficientemente inteligente como para manejarlo).

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!