vue过滤器filters获取不到this对象的解决办法

<template>
  <div>{{a|sum(that)}}</div>
</template>

<script>
  export default {
    name: "test",
    data() {
      return {
        that: this,
        a: 1,
        b: 2
      }
    },
    filters: {
      sum(a, that) {
        console.log(that);
        return a + that.b;
      }
    },
  }

  

posted @ 2020-07-07 11:01  Samuel-Leung  阅读(5639)  评论(0编辑  收藏  举报