vue父组件 过滤器filter 传递给子组件(记录)

339 阅读1分钟

代码为简单示意

this.$options.filters['过滤器名称']

父组件 parent  自组件 child
<parent>
    <child
        :getText="$options.filters.getText"
    ></child>
</parent>
-----------
filters: {
    getText(val) {
        return val + '%';
    }
}