0
点赞
收藏
分享

微信扫一扫

Java虚拟机(jvm)常见问题总结

ZGtheGreat 2024-05-02 阅读 8

问题:切换页码时,勾选的数据会被清空 

 

 重点看我圈出来的,直接复制,注意,我这里  return row.productId;一般大家的是 return row.id,根据接口定的唯一变量

 :row-key="getRowKeys"​​​​​​​

 :reserve-selection="true"

  getRowKeys(row) {
        return row.productId;
      },

 官方解说

 

 

参考我项目里的下方代码 

 <el-table v-loading="listLoading"
              :data="list"
                ref="multipleTable"
              border
              fit
              @selection-change="handleSelectionChange"
            :row-key="getRowKeys"
              highlight-current-row>
      <el-table-column
      :reserve-selection="true"
        type="selection"
        width="40">
      </el-table-column>
      <el-table-column align="center"
                       width="180px"
                       label="销售单号">
        <template slot-scope="scope">
          <span>{{ scope.row.orderId }}</span>
        </template>
      </el-table-column>
    </el-table>


  data () {
    return {
  getRowKeys(row) {
        return row.productId;
      },
rowSelection:'',
    }


  methods: {
  handleSelectionChange(val) {
      this.rowSelection = val;
 
    },
}

 

举报

相关推荐

0 条评论