0

How to change style(color) of paragraph in Vue if element (boolean) from api returns true

<p v-if="discount = false">Discount</p>

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.