Can you help me understand this error?
I encountered this issue when I inserted my filteredData variable within 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 how my method looks like:
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);
}
The fetchedData retrieves data from here:
async mounted() {
await axios.get("http://localhost:5000/individuals").then((result) => {
this.fetchedData = result.data;
console.log(this.fetchedData);
});
},