[Vuejs]-For loop through array and bind class to element class attribute in vuejs

0👍

Your code is a little confusing.

What does paymentTypeClass look like? It looks like you want all the classes on the element based on your logic? If so you can do like:

paymentTypeClasses () {
  const classes = this.paymentType.map(type => 'o-pf-list__item--' + type)
  classes.push('pull-left')
  return classes
}

Then do

:class="paymentTypeClasses()"

or

:class="[paymentTypeClasses()]

(easier to add more classes later)

Leave a comment