0π
It should be
filterSearch(){
return this.teachers.data.filter((teacher) => {
return this.employees = teacher.name.match(this.searchTerm);
})
}
teachers.data.filter
vs. teachers.filter
as you have it β since you are holding an object inside the teachers
, not an array. Which Iβd suggest the opposite β make the teachers the array and in the getTeachers()
method do this.teachers = response.data.data
Then also make the employees
property an array too. B/c after filtering teachers array within the computed property, you will get an array back, not the object.
If you follow this route β make both teachers and employees an array β then your computed property should not change and it will work as you have it
Source:stackexchange.com