0👍
✅
This really isn’t the “Vue” way of doing things.
Instead what you want to do is let the data drive your display, so instead of trying to find all overdue things and style them, have the things style themselves if they are over due.
For example
<my-component :style='compstyle' v-for="t in todos"></my-component>
Then on your component have a property to bind that style
computed: {
compstyle : function(){
return (new Date(this.deadline) < new Date()) ? {'backgroundColor' : 'red'} : {}
}
}
Source:stackexchange.com