Vue.filter()

Vue.filter( id, [definition] )

  • Arguments:

    • {String} id
    • {Function | Object} [definition]
  • Usage:

    Register or retrieve a global filter.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    // register
    Vue.filter('my-filter', function (value) {
      // return processed value
    })
     
    // two way filter
    Vue.filter('my-filter', {
      read: function () {},
      write: function () {}
    })
     
    // getter, return the filter if registered
    var myFilter = Vue.filter('my-filter')
  • See also: Custom Filter

doc_VueJS
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.