8. The use of the filter

Vue.js allows you to customize filters, it can be used for some common text formatting.

Filters can be used in two places: double braces interpolation and  v-bind expression (the latter is supported from 2.1.0+).

The filter should be added at the end of the JavaScript expression, by the "pipe" symbol indicates:

  Global Filters:  

        Vue.filter ( 'Filter Name', function (value) {
          return your logic;
        })

    

  Use: {{   to be processed value | filter name   }}

    

  return

    

   Local filter:  

    

    

 

   Disclaimer Filters:

      filters: {
        Filter Name: function (process value) {
          logic
        return return value
        }
      }

 

Guess you like

Origin www.cnblogs.com/sunny666/p/11082002.html