From 6071c823931772e8aeb3af935296be6c97e08572 Mon Sep 17 00:00:00 2001 From: Paul Isaris Date: Fri, 19 Oct 2018 16:40:12 +0300 Subject: [PATCH] Fix(guide): Add v-for index documentation --- guide/english/vue/control-flow/index.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/guide/english/vue/control-flow/index.md b/guide/english/vue/control-flow/index.md index a72f346771..ab89ece911 100644 --- a/guide/english/vue/control-flow/index.md +++ b/guide/english/vue/control-flow/index.md @@ -109,3 +109,19 @@ app.list.push("something else"); ``` As expected, the page rendered now has our brand new item! + +### Accessing current index in loops + +`v-for` also supports an optional second argument for the index of the current item: + +```html +
+ +
+``` +This way, we can use `index` to style the first, last or even/odd list elements differently, or apply extra logic to our component. +