I'm trying to figure out how to bind classes to a table row conditionally based on a vue model.
IN my blade I have:
.low-priority{
background-color: purple;
}
.high-priority{
background-color: orange;
}
.important-priority{
background-color: yellow;
}
.critical-priority{
background-color: red;
}
and in my vue template I return a dateEvents
object which has a value called priority
which can be "High"
, "Low"
, "Important"
or "Critical"
.
I want to set the class of this table row by those priorities:
<tr v-bind:class="dateEvent">
I've seen the docs for binding a class if a return is true or false, but how do I do this appropriately with conditionals, i.e. if dateEvent.priority === 'Low' then class is .low-priority'