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

258
Visualizações
TypeError: Cannot read properties of null (reading 'subTree')

What does this error mean?

error message

this happens when I put my filteredData variable inside the tr tag of the table.

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

This is my method:

  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 get the data from this:

  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 Respostas
Responde à pergunta

0

I am guessing this: <tr v-if="(filteredData = '')"> should be: <tr v-if="filteredData === ''">, or even beter: v-if="!filteredData.length". You've misspelled the variable name and are accidentally setting it to an empty string rather than doing a comparison (we've all been there, I'm sure)

On a related note, I would initialize fetchedData and filteredData as empty arrays, not strings, because v-for is meant to iterate over objects and arrays, not strings (even though it's probably smart enough to handle it).

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