2

I want to give icon color with for loop. I have tried in this way. But getting no result. I know it's possible to bind style.

<v-tab v-for="navtab in navtabs" :key="navtab">
    <v-icon color="{{ navtab.color }}">{{ navtab.icon }}</v-icon>
</v-tab>

Data property:

<script>
export default {
    data () {
      return {
      navtabs: [
        {
          icon: 'info',
          name: 'About Book',
          color: 'teal darken-2'
        },

        {
          icon: 'favorite',
          name: 'Specification',
          color: 'orange darken-2'
        }
      ]
   }
}

How can I do this?

2
  • Is darken-2 a color or css class? Commented Mar 27, 2019 at 18:10
  • color name. You can see any example in vuetify. Commented Mar 27, 2019 at 18:15

1 Answer 1

4

You should not use:

<v-icon color="{{ navtab.color }}">{{ navtab.icon }}</v-icon>

Instead, bind the variable color:

<v-icon :color="navtab.color">{{ navtab.icon }}</v-icon>
Sign up to request clarification or add additional context in comments.

Comments

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.