[Vuejs]-For each item add class if value is true

0๐Ÿ‘

โœ…

1) Define $myArray outside the while:

$myArray = [];

2) Add the class to the row itself and push it to the array (this goes inside the while):

$row['class'] = $categorytoadd;
array_push($myArray, $row);

3) Finally, use the row class when you display the item:

<p :class="['video', item.class]">{{ item.name_short }}</p>

Leave a comment