Join Michael Sullivan for an in-depth discussion in this video Using additional v-for parameters, part of Learning Vue.js.
- [Instructor] Now we'll look at some more v-for syntax…to see what else it can do.…One thing you don't always have easy access to,…when iterating with a for each or a for in…in some programming languages…is the index of the current item.…There are a lot of reasons you might want it.…For example, if you just wanted to add a column…called number up here,…that would just be a simple numbering…from one to 10 in this case.…In Vue, this is really easy.…We just add a second parameter after the a here,…usually we name it index,…and then we need to wrap them both in parentheses.…
And then we can just add another cell down here…and put index inside curly braces.…And that's going to be zero-based, of course,…so we might just want to add one to it.…Now, if we refresh, we see the number column…with the index there, plus one.…I mentioned before that…we don't have to be iterating over an array,…we could also iterate over, for example,…the keys and values of object properties.…
Let's take a look at the Close Approach Data, again,…
- Adding Vue to a webpage
- Thinking declaratively with data binding
- Methods and event handling
- Adding dynamic style and class attributes
- Using CSS transitions and animations
- Using Vue components
- Vue CLI
Skill Level Intermediate
Web Programming Foundationswith Morten Rand-Hendriksen58m 44s Beginner
What you should know1m 29s
1. The Simplest Form
2. Essential Directives, Options, and Tools
3. Enhancing User Interfaces
4. Vue Components
Next steps2m 32s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.