We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
(key,val) in arr
v-for
1 parent e879b8f commit 7e5577cCopy full SHA for 7e5577c
src/directives/public/for.js
@@ -11,7 +11,13 @@ module.exports = {
11
// support "item in items" syntax
12
var inMatch = this.expression.match(/(.*) in (.*)/)
13
if (inMatch) {
14
- this.alias = inMatch[1]
+ var itMatch = inMatch[1].match(/\((.*),(.*)\)/)
15
+ if (itMatch) {
16
+ this.iterator = itMatch[1]
17
+ this.alias = itMatch[2]
18
+ } else {
19
+ this.alias = inMatch[1]
20
+ }
21
this.expression = inMatch[2]
22
}
23
@@ -207,6 +213,9 @@ module.exports = {
207
213
// avoid accidental fallback
208
214
_.define(scope, '$key', null)
209
215
216
+ if (this.iterator) {
217
+ _.defineReactive(scope, this.iterator, key || index)
218
210
219
var frag = this.factory.create(host, scope, this._frag)
211
220
frag.forId = this.id
212
221
this.cacheFrag(value, frag, index, key)
0 commit comments