首选,项目根目录下创建一个filter文件,然后新建一个index.js文件,在index文件中引入vue,将这个index文件在man.js中全局引入,

filter文件的写法如下

vue的methods方法中如何使用filter

在methods中的使用方法如下:

this.$options.filters.penaltyType(error.msg)
其中penaltyType为调用的过滤器名称,error.msg为ajiax请求后台返回的code,即过滤器的参数

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2023-03-05
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2021-07-28
  • 2021-08-20
  • 2022-12-23
相关资源
相似解决方案