2👍
✅
To get the filtered list
from selected
, use a computed
computed{
filtered(){
if (this.selected === null) return this.services.list
return this.services.list.filter(s => s.category === this.selected)
}
}
Then you can use filtered
in your template
1👍
computed: {
filtered() {
if (this.selected === null) return this.services.list
return this.services.list.filter(obj => obj.category === this.selected)
}
}
Source:stackexchange.com