el-table 多选 分页情况(记住每一页选中的数据)

  <el-table
    ref="elTableRef"
    v-loading="loading"
    :data="tablerows"
    style="width: 100%"
    class="bg-table"
    :height="height"
    stripe
    tooltip-effect="light"
    :border="border"
    :row-key="getRowKeys"
    @selection-change="selectAction"
    @sort-change="sortChange"
  >
    <!-- 多选框 -->
    <el-table-column
      v-if="isSelect"
      type="selection"
      :reserve-selection="true"
      :selectable="selectables"
      width="80"
      align="center"
    >
  // ***********多选框功能start

  // 选中项
  const selectAction = (selection) => {
    emits('selection', selection)
  }

  // 指定主键key
  const getRowKeys = (row) => {
    return row.id
  }
  // ***********多选框功能end

row-key

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

reserve-selection

数据刷新后是否保留选项,仅对 type=selection 的列有效, 请注意, 需指定 row-key 来让这个功能生效。

selection-change

当选择项发生变化时会触发该事件

清空[ref].clearSelection()

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天高任鸟飞dyz

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值