element-ui中的table记住分页多选框选中的数据

     <el-table
            v-loading="widgetListLoading"
            ref="multipleTable"
            :data="notAddwidgetList"
            :row-key="getRowKeys"
            border
            stripe
            tooltip-effect="dark"
            style="width: 100%"
            @selection-change="handleSelectionChange">
            <el-table-column
              :reserve-selection="true"
              type="selection"
              width="55"/>

在method中添加这个方法: 

  getRowKeys(row) {
      return row.id
    },

table中的多选框,点击下一页时,需要记住上一页的数据,因此需要添加

:row-key="getRowKeys"

:reserve-selection="true"

getRowKeys(row) {

return row.id

},

在完成后,需要清空选中的
this.$refs.multipleTable.clearSelection()

猜你喜欢

转载自blog.csdn.net/u011662320/article/details/88344295