0

I am trying to style the multi select of an input based on the value. when i put the condition in vue like the following i am getting the color on all the div including the label here is my code

<custom-select 
  :class="{
    orange : campaignStatus.value ==='ARCHIVED' || campaignStatus.value ==='PAUSED',
    red : campaignStatus.value ==='BANNED' || campaignStatus.value ==='REMOVED'
  }"
  v-model="campaignStatus"
  deselectLabel="Selected"
  label="Status"
  :options="statusOptions" 
  name="status" 
  data-test="campaign-status"
  disabled>
</custom-select>

and the result is this: enter image description here

the goal is to have just the multi-select colored orange like that enter image description here

the issue is that i dont have the multiselect.multislect_input in my html template so i can i style the multiselect based on its value? for example orange for archived and red for expired?

1
  • Please provide some more information about your css classes and the rendered html code. A jsfiddle with minimal working code would help a lot. Commented Mar 29, 2020 at 8:44

1 Answer 1

0

You must have a class of color in css first. For example:

.orange{color:orange}
.red{color:red }

And then you can use these classes in vue. Like:

:class="{'orange': campaignStatus.value === ARCHIVED , 'red': campaignStatus.value === EXPIRED}"
Sign up to request clarification or add additional context in comments.

3 Comments

i am using vuetify so the code i mentioned is working but its working for the entire class and not for multiselect part. i need only for the word "archived" to be in orange
You can try with this campaignStatus.value ===' <span class="orange">ARCHIVED</span>'
From where data of selectbox inserting?

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.