0👍
As order
is an object, order % 2 === 0
will always return false and it applied the else class which is bg-light-grey
.
You should apply condition on the iteration index
. Change your logic to :
<div
v-for="(order, index) in allOrders"
:class="index % 2 === 0 ? 'bg-white' : 'bg-light-grey'"
:key="index"
>
{{ order.description }}
</div>
- [Vuejs]-Vuefire: how to declare a reactive collection using usecollection() before the collection path is known?
- [Vuejs]-How to format label on PolarArea chart.js vue-chartjs
Source:stackexchange.com