[Vuejs]-Vue.js – conditionally assign a CSS class

3👍

You’re not escaping the "" inside :class="{ (activeTab == 'tab2') ? "active" : "inactive" }" so should replace " by ' and change the syntax based on this:

:class="{ active: (activeTab == 'tab2'), inactive: (activeTab !== 'tab2')}"

Leave a comment