<template>
<!-- 这里过滤器一定要把that传过去 -->
<div>{{ a |filter(that)}}</div>
</template>
<script>
export default {
name: "test",
data() {
return {
that: this,
a: 1,
b: 2
}
},
filters: {
filterType(a, that) {
console.log(that);
return a + that.b;
}
},
}
</script>
vue过滤器filters获取不到this对象的解决办法
最新推荐文章于 2022-11-04 14:28:24 发布