I encountered the following error message:
TypeError: Cannot read property 'name' of undefined
Here's the snippet from the Vue file where the error occurred:
<tr v-for="user in fields.data" :key="user.id">
<td>{{ user.id }}</td>
<td>{{ user.name }}</td>
<td>{{ user.email }}</td>
<td>{{ user.password }}</td>
<td>
<a href="#" data-toggle="modal" data-target="#modal" @click="edit(user.id)">
<span class="btn btn-primary">
<i class="mdi mdi-edit"></i>
</span>
</a>
</td>
</tr>
The corresponding script section is as follows:
edit(id) {
this.users = this.fields[id];
console.log(this.users);
},