Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMIHA W.LEE
PHP Development Techdegree Graduate 25,452 PointsVue JS color
Hey guys!! I just finished the tutorial, but I have one thing that I dont know, that is when the style set to 'item', is the 'item' referring to the v-for 'item'?
I just want to know where does the value come from.
Thank you so much!!
1 Answer
Daniel Millier
16,342 PointsI know this is a year old, but to answer your question:
<li v-bind:style="{color:color}" v-for="color in rainbow">{{color}}</li>
- The first property of 'color' is referring to the CSS selector to change the text color.
- The second property-- between the colon ( : ) --is referring to the item we want to apply the style to.
We can name the item any name we want, such as 'basketball', like so:
<li v-bind:style="{color:basketball}" v-for="basketball in rainbow">{{basketball}}</li>
Hope this helps!