Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Set dynamic css class on vue,js

I’m trying to set a dynamic class in a vue.js, something like

 <strong :class=`color-${category.level}`>{{ category.name }}</strong>

this html is inside a for loop and I need the category.value on this loop but it’s not working

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The bound class value should be wrapped by quotes :class='...' or double-quotes :class="..." :

<strong :class="`color-${category.level}`"></strong>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading