0

wen i run this script with vue.js and bootstrap ( vertical tab )

<vue-tabs class="row" direction="vertical" value="Description" >      
  <div v-for="(item, index) in siteObject.line_info" :key="index">
    <v-tab :title="siteObject.line_info[index].lineid">
      <div class="description text-left">
        <small v-for="(field, key) in item" :key="key">
          <strong>{{ key }}</strong> {{ field }}<br>
        </small>
      </div>
    </v-tab> 
  </div>     
</vue-tabs>

I have this result

nsn 0102753206

upk 1018.0-1/2

status ACTIVE

lex_id 79VOLGUTD

What can i do that when status is Active then is all text is red?

2 Answers 2

2

Have you looked at Class & Style bindings?

Add :class="{ 'text-danger': status === 'Active' }" to the element you want to apply your red text to.

Then create your .text-danger in your css.


In this example we are essentially saying:

IF status is equal to Active EXACTLY, Add a class of text-danger

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

7 Comments

i add the class juste after <vue-tabs> and creat css <style> .redTextClass { color:red; } </style> nothing changes
thank you for your help am new with this stuff can you help me more please with my example ? i mean the same thing but without button many thanks
@Sofiane it looks to me that you want it to match ACTIVE and not Active? based on the data that you've presented above. Have you tried that?
Are you using Vue devtools? What is status showing as there? What are you applying the class to?
am using it what should i take look props data or computed ?
|
0
<vue-tabs class="row" direction="vertical" value="Description" >
     <div  v-for="(item, index) in siteObject.line_info" :key="index">
        <v-tab :title="siteObject.line_info[index].lineid">
            <div class="description text-left" :class="{ 'text-danger': item.status === 'ACTIVE' }">
                <small v-for="(field, key) in item" :key="key">
                    <strong>{{ key }}</strong> {{ field }}<br>
                </small>
                <pre>{{item.status}}</pre>
            </div>

        </v-tab>

    </div>

  </vue-tabs>

and style

<style scoped>
  .text-danger {
    color: red !important;
  }
</style>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.