Level 47
Just wondering why you're assigning _self to this? You typically don't need to do that in your methods. Also, I think you're not getting output from your else because filter does not mutate the array, you need to still re-assign the value. Your method could be re-written to something like this:
Also, what is values? Do you have that in your data on the component?
methods: {
formated (item) {
this.values.length = 0;
if (item == "") {
this.values = this.applicants;
} else {
this.values = this.applicants.filter(applicant => someConditionHere);
}
}
}
1 like