之前写angularjs的时候,filter是可以直接在ng-repeat中使用。但是到了vue好像这个不起作用。

 

具体解决办法:

 

加一个计算属性:

        computed:{
            filterData: function () {
                console.log(JSON.parse(JSON.stringify(this.data)));
                return JSON.parse(JSON.stringify(this.data));
            }
        }

 

然后template中直接引用filterData就可以了,所有过滤的操作可以直接写在filterData属性的后面那个function中。

 

使用:

<Row  v-for="(item, index) in filterData"> </Row>

 

注: filterData不能在data中定义,这是一个计算属性,否则会报错。

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-02-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-30
  • 2022-12-23
相关资源
相似解决方案