Element ui 中使用table组件实现分页记忆选中

Element ui 中使用table组件实现分页记忆选中

旧方法

新方法

用element-ui table里这个参数
reserve-selection -->仅对 type=selection 的列有效,类型为 Boolean,为 true 则代表会保留之前数据的选项,需要配合 Table 的 clearSelection 方法使用。

配合row-key -->行数据的 Key,用来优化 Table 的渲染;在使用 reserve-selection 功能的情况下,该属性是必填的。类型为 String 时,支持多层访问:user.info.id,但不支持 user.info[0].id,此种情况请使用 Function。


                    
                    
                    
                    
                    
                    
                    
                
                
                
data(){
    return{
        // 获取row的key值
        getRowKeys(row) {
            return row.id;
        },
    }
}

methods:

//选择筹款订单
            handleSelectionChange(rows) {
                this.multipleSelection = rows;
                this.select_order_number = this.multipleSelection.length;

                this.select_orderId = [];
                if (rows) {
                    rows.forEach(row => {
                        if (row) {
                            this.select_orderId.push(row.orderid);
                        }
                    });
                }
            }

原文参考地址:https://segmentfault.com/q/1010000012976664/a-1020000013052695

你可能感兴趣的:(VUE)