Reputation: 13
How to change style(color) of paragraph in Vue if element (boolean) from api returns true
<p v-if="discount = false">Discount</p>
Upvotes: 0
Views: 4755
Reputation: 482
You can use the class binding v-bind:class
or shorthand :class
to accomplish this.
Same goes for v-bind:style | :style
Example:
<p :class="{ 'someClass': discount, 'someotherClass': !discount }">Discount</p>
Resource: VueJS Class and Style binding
Upvotes: 1