Answers for "how to bind class conditionally in vue"

14

vue conditional class

<div :class="{ 'prop-name': boolVar }"></div>
Posted by: Guest on March-15-2020
-1

vue class binding if else

vue class binding if else
<div :class="{ 'prop-name': boolVar }"></div>
:class="darkMode ? 'dark-theme' : 'light-theme'"
If darkMode is true, we apply dark-theme as our class name. 
	Otherwise we choose light-theme.
Posted by: Guest on December-04-2020

Browse Popular Code Answers by Language