解决方法:

1、定义一个变量:

2、在beforeCreate生命周期将this赋值给that,通过that获得

var vm = new Vue({
    el: '#app',
    data: {

    },
    beforeCreate: function () {
        that = this
    },
    methods:{
      fom(fmt){
        ...
      }
    },
    ....,
    filters: {
              dateformate: function (val) {
                  return that.fom("yyyy-MM-dd")
              }
          }
    })

 

过滤器学习笔记: https://www.cnblogs.com/meiyanstar/p/14759634.html

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2021-12-03
  • 2021-11-29
  • 2022-02-08
  • 2021-08-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2022-01-18
  • 2021-06-17
  • 2022-12-23
  • 2021-07-28
相关资源
相似解决方案