@@ -216,9 +216,7 @@ function processFor (el) {
el.alias = alias
}
if ((exp = getAndRemoveAttr(el, 'track-by'))) {
- el.key = exp === '$index'
- ? exp
- : el.alias + '["' + exp + '"]'
+ el.key = exp
@@ -295,7 +295,7 @@ describe('Directive v-for', () => {
{ id: 3, msg: 'c' }
]
},
- template: '<div><div v-for="item in items" track-by="id">{{ item.msg }}</div></div>'
+ template: '<div><div v-for="item in items" track-by="item.id">{{ item.msg }}</div></div>'
})
vm.$mount()
expect(vm.$el.textContent).toBe('abc')