diff --git a/src/compiler/helpers.js b/src/compiler/helpers.js index 9a91e8bb..d5ac6ab2 100644 --- a/src/compiler/helpers.js +++ b/src/compiler/helpers.js @@ -1,5 +1,7 @@ /* @flow */ +import { parseFilters } from './parser/filter-parser' + export function baseWarn (msg: string) { console.error(`[Vue parser]: ${msg}`) } @@ -72,7 +74,7 @@ export function getBindingAttr ( getAndRemoveAttr(el, ':' + name) || getAndRemoveAttr(el, 'v-bind:' + name) if (dynamicValue != null) { - return dynamicValue + return parseFilters(dynamicValue) } else if (getStatic !== false) { const staticValue = getAndRemoveAttr(el, name) if (staticValue != null) { diff --git a/src/compiler/parser/index.js b/src/compiler/parser/index.js index 90867cdb..6ae8f4b3 100644 --- a/src/compiler/parser/index.js +++ b/src/compiler/parser/index.js @@ -3,6 +3,7 @@ import { decode } from 'he' import { parseHTML } from './html-parser' import { parseText } from './text-parser' +import { parseFilters } from './filter-parser' import { cached, no, camelize } from 'shared/util' import { isIE, isServerRendering } from 'core/util/env' import { @@ -375,6 +376,7 @@ function processAttrs (el) { } if (bindRE.test(name)) { // v-bind name = name.replace(bindRE, '') + value = parseFilters(value) if (modifiers && modifiers.prop) { isProp = true name = camelize(name) diff --git a/test/unit/features/filter/filter.spec.js b/test/unit/features/filter/filter.spec.js index 928fae72..14d58cb8 100644 --- a/test/unit/features/filter/filter.spec.js +++ b/test/unit/features/filter/filter.spec.js @@ -29,6 +29,31 @@ describe('Filters', () => { expect(vm.$el.textContent).toBe('IH') }) + it('in v-bind', () => { + const vm = new Vue({ + template: ` +