From 68372ea26b0183ce5e2c25a3a7c291195dae7d25 Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 4 May 2016 16:48:47 -0400 Subject: [PATCH] update track-by usage --- src/compiler/parser/index.js | 4 +--- test/unit/features/directives/for.spec.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/compiler/parser/index.js b/src/compiler/parser/index.js index d946fcb8..9274d9c6 100644 --- a/src/compiler/parser/index.js +++ b/src/compiler/parser/index.js @@ -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 } } } diff --git a/test/unit/features/directives/for.spec.js b/test/unit/features/directives/for.spec.js index 085ee5b7..a5a6ea47 100644 --- a/test/unit/features/directives/for.spec.js +++ b/test/unit/features/directives/for.spec.js @@ -295,7 +295,7 @@ describe('Directive v-for', () => { { id: 3, msg: 'c' } ] }, - template: '
{{ item.msg }}
' + template: '
{{ item.msg }}
' }) vm.$mount() expect(vm.$el.textContent).toBe('abc')