I created a Vuejs component as shown here.
My objective is to access the value inside the filteredShoes method of the watch feature.
data():{
coor: [
{ "name": '',
"shoes": '' },
{ "name": '',
"shoes": '' }
]
},
computed {
filteredAny(){
return this.coor.filter(it=>['shoes','name'].includes(it));
},
filteredShoes(){
return this.coor.filter(it=>it === 'shoes');
},
filteredName(){
return this.coor.filter(it=>it === 'name');
}
}
watch {
filteredShoes(){
console.log('The shoes have been updated');
}
}
So I attempted the following, but it returned an error indicating val is undefined.
I am hoping that 'val' reflects the values in 'coor' from the data section.
How can I resolve this issue? Thank you for taking the time to read.
watch {
filteredShoes(val){
for(let i=0; i < val.length; i+=1){}
}
}