Reset filters and sorters #
Control filters and sorters by filteredValue and sortOrder.
Defining filteredValue or sortOrder means that it is in the controlled mode.
Make sure sortOrder is assigned for only one column.
column.key is required.
https://www.antdv.com/components/table/#components-table-demo-reset-filters-and-sorters
园豆:14208
(专家六级)
2021-02-02 14:46
let {a,b}=this. 简单说就是从this里面提取a和b2个字段.
和 let a=this.a; let b=this.b; 差不多一个意思.
第二行就是如果sortedinfo是null或者undefined之类的就初始为
{}
let a=this.a;
if(!a) a = {};
园豆:14208
(专家六级)
2021-02-02 15:21
console.log(sortedInfo.columnKey); // output undefined;
console.log(undefinedObject.columnKey); // trhow undefined exception.
别放了这里的代码, 在table改变的时候, 会callback到这个方法. 对sortedInfo 对象赋值.
handleChange(pagination, filters, sorter) {
console.log('Various parameters', pagination, filters, sorter);
this.filteredInfo = filters;
this.sortedInfo = sorter;
园豆:14208
(专家六级)
2021-02-02 16:16
@滴水不漏dayday:
简单说就是每一个计算属性
(columns)所用到的数据
(data.columns, data.sortedInfo)任意一个发生改变
,计算属性就会重新计算
,并反应到UI上.
官方文档:
https://cn.vuejs.org/v2/guide/computed.html
https://cn.vuejs.org/v2/api/#computed
园豆:14208
(专家六级)
2021-02-02 21:20