Vue: Chaining multiple filters without spaces doesn't work

Created on 8 Feb 2017  ·  2Comments  ·  Source: vuejs/vue

Vue.js version

1.0.28

Reproduction Link

https://jsfiddle.net/8L7f9u53/2/

Steps to reproduce

  1. Define few filters
  2. Apply them each other

What is Expected?

Pipelining (chaining) filters

What is actually happening?

Only first filter executes


<div id="mount-point">
  <p v-text="test|foo"></p>      <!-- string.foo -->
  <p v-text="test|bar"></p>      <!-- string.bar -->
  <p v-text="test|foo|bar"></p>  <!-- string.foo but expected string.foo.bar -->
</div>
Vue.filter('foo', function(s) {
  return s + '.foo';
})
Vue.filter('bar', function(s) {
  return s + '.bar';
})

new Vue({
  el: '#mount-point',
  data: {
    test: 'string'
  }
})

Most helpful comment

Hmm, there are not strictlify filter grammer spec in docs, but I think pipelining filters with space is good human readable coding design.
http://v1.vuejs.org/guide/custom-filter.html

All 2 comments

https://jsfiddle.net/8L7f9u53/3/
please pipelining filters with space

Hmm, there are not strictlify filter grammer spec in docs, but I think pipelining filters with space is good human readable coding design.
http://v1.vuejs.org/guide/custom-filter.html

Was this page helpful?
0 / 5 - 0 ratings