zoukankan      html  css  js  c++  java
  • el-table多选框,分页保留上页选中目标

    1、在 el-table中,设置table的唯一标识:row-key="id",在复选框列中,设置 reserve-selection ,设置为 true 时,则点击分页的时候,根据table中的 row-key ,来保留之前选中的数据,

       <!-- 表格控件 -->
        <el-table :data="tableData" style=" 100%" :fit="true" @selection-change="handleSelectionChange" row-key="id" :header-cell-style="{background:'#F0F2F5',color:'#585858',textAlign: 'center',fontSize: '12px'}" > <el-table-column type="selection" align="center" reserve-selection width="55"> </el-table-column> <el-table-column prop="merId" min-width="90" align="center" show-overflow-tooltip label="商户号"> <template slot-scope="scope"> {{scope.row.refId}}({{scope.row.refname}}) </template> </el-table-column> </el-table>
        <!-- 分页控件 --> <div class="pagein_box"> <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNo" :page-sizes="[10, 20, 30 ,40]" layout=" prev, pager, next,sizes, jumper, total" :total="pageInfo.totalNum" :pager-count= "5" > </el-pagination> </div>

    2、

                // 获取当前点击的每页几条
                handleSizeChange(val) {
                    this.pageSize = val;
                    this.getRoleLists();
                },
                // 点击切换分页页码,获取当前点击的是第几页
                handleCurrentChange(val) {
                    this.pageNo = val;
                    this.getRoleLists();
                },
    
  • 相关阅读:
    缺省参数的注意事项
    可变和不可变类型
    Python之旅
    BBS项目 个人界面分类,文章,模板的使用详解
    Django 模板
    BBS项目 部分主界面and个人博客界面代码详解
    BBS项目 注册界面and部分首页代码详解
    BBS项目 备忘时时更新
    BBS项目 登录界面代码详解
    BBS项目 基本表关系
  • 原文地址:https://www.cnblogs.com/moguzi12345/p/13897159.html
Copyright © 2011-2022 走看看