diff --git a/src/compiler/parser/filter-parser.js b/src/compiler/parser/filter-parser.js index ca8ead850ae..10939d3fb34 100644 --- a/src/compiler/parser/filter-parser.js +++ b/src/compiler/parser/filter-parser.js @@ -92,6 +92,6 @@ function wrapFilter (exp: string, filter: string): string { } else { const name = filter.slice(0, i) const args = filter.slice(i + 1) - return `_f("${name}")(${exp},${args}` + return `_f("${name}")(${exp}${args !== ')' ? ',' + args : args}` } } diff --git a/test/unit/modules/compiler/codegen.spec.js b/test/unit/modules/compiler/codegen.spec.js index b1085a571df..50854e75a14 100644 --- a/test/unit/modules/compiler/codegen.spec.js +++ b/test/unit/modules/compiler/codegen.spec.js @@ -44,6 +44,13 @@ describe('codegen', () => { ) }) + it('generate filters with no arguments', () => { + assertCodegen( + '
{{ d | e() }}
', + `with(this){return _c('div',[_v(_s(_f("e")(d)))])}` + ) + }) + it('generate v-for directive', () => { assertCodegen( '
  • ',