美文网首页
Vue之在methods中使用filter的方法

Vue之在methods中使用filter的方法

作者: studentliubo | 来源:发表于2018-12-18 10:52 被阅读6次

1、filter有两种方式

设置全局的filter的方法

  Vue.filter(‘name’,function (val) {})

设置当前组件的方法

 filter: {
  functionName (val) {
  // logic process
  }
}

2、如果想在methods中使用filters的方法,相应的就有两种方法

使用全局的filter: Vue.filters['filterName'] (val)
使用局部的filter: this.$options.filters['filterName'] (val)

相关文章

网友评论

      本文标题:Vue之在methods中使用filter的方法

      本文链接:https://www.haomeiwen.com/subject/raekkqtx.html