I'd like to check the value of my template
        <template slot="projected_end_date" slot-scope="{ line }">
            <datetime-display :value="line.projected_end_date"
                              type="date"
            style= "color: red"></datetime-display>
         </template>
and only set the style for red color when my value is less than current date. Any suggestion? I'm assuming it should be something like
value > DateHelper.now()? style = ...
You can use class and style binding like this:
:style="value < DateHelper.now() ? { 'color': 'red'} : ''"
Or,
:style="{color: value < DateHelper.now() ? 'red' : 'inherit'}"
Or some default color:
:style="{color: value < DateHelper.now() ? 'red' : 'black'}"
But I suggest you to use class binding whenever possible:
:class="{warning: value < DateHelper.now()}"
And in your css styles:
.warning {
   color: red;
}
Also, you can simply use Date.now() instead of a helper function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With