[Vuejs]-Dynamically bind a class in vue js via a method on the parent component

1👍

Thanks to all the people who tried to answer, I figured it out myself in the end. I had to convert the integer to a string before it would be accepted as a viable class name. See below:

featuresLength() {
  return this.products[0].features.length.toString()
}

Then combine that with the answers above:

<Halo :featuresCount="featuresLength()"> .. etc 

and it worked!

0👍

I think you forgot to bind :featuresCount like this

<Halo :featuresCount="featuresLength">...</Halo>

Leave a comment