|
|
|
|
|
by dmitriid
1777 days ago
|
|
> How is it invalid? Here's the syntax about a for..in loop for (variable in object) {
statement
}
And here's the syntax for Vue's for..in loop. Only one of it is somewhat Javascript: item in items
(item, index) in items
(val, key) in object
(val, name, index) in object
And, of course, there's an extension to that v-for="item in items" :key="item.id"
Edit: additionally, from that very link: "for...in should not be used to iterate over an Array where the index order is important." But this doesn't concern Vue, it maintains the order in its for..in. |
|