Skip to content

Commit d8335c2

Browse files
committed
fix two-way filter in attribute interpolations (fix vuejs#779)
1 parent de3b59f commit d8335c2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/parsers/text.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ function inlineFilters (exp) {
169169
var args = filter.args
170170
? ',"' + filter.args.join('","') + '"'
171171
: ''
172-
exp = 'this.$options.filters["' + filter.name + '"]' +
172+
filter = 'this.$options.filters["' + filter.name + '"]'
173+
exp = '(' + filter + '.read||' + filter + ')' +
173174
'.apply(this,[' + exp + args + '])'
174175
}
175176
return exp

test/unit/specs/parsers/text_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe('Text Parser', function () {
119119
it('tokens to expression with filters, multiple expressions', function () {
120120
var tokens = textParser.parse('a {{b | c d}} e')
121121
var exp = textParser.tokensToExp(tokens)
122-
expect(exp).toBe('"a "+this.$options.filters["c"].apply(this,[b,"d"])+" e"')
122+
expect(exp).toBe('"a "+(this.$options.filters["c"].read||this.$options.filters["c"]).apply(this,[b,"d"])+" e"')
123123
})
124124

125125
})

0 commit comments

Comments
 (0)