I'd like to choose class of an element bases on importance:
<strong> Importance:
<span :class="importance ? (calculate class here)">
</span> {{someText}}
</strong>
Let's say the class vlue should be imp0 ,imp1,imp2, imp3 or imp4, depending on whether importance equals 0,1,2,3 or 4.
You may ask why not calculate the value in a method function?
The answer is: to keep the class value synced with the result of a separate method which also gets importance as input parameter after the class is rendered.
So wondering how can I achieve this?
Update: I managed to do it with a convulted ternary conditional:
:class="importance==0 ? 'imp0': (importance==1? 'imp1': (importance==2 ? 'imp2': (importance==3 ? 'imp3': 'imp4')))
but wondering if there is a more clean way to do so?