【无标题】

发布时间:2023年12月26日
<publicTable
 ref="publicTable"
 class="table"
 :table-data="tableData"
 :table-info="tableInfo"
 :table-column="columns"
 :events="events"
 :is-need-pagination="false"
 :has-operation="false"
 :loading="loading"
 :need-select="true"
 >

el-table组件的封装_el-table封装-CSDN博客

events: {
        'selection-change': selection => {
          if (selection.length > 1) {
            const newRows = selection.filter((it, index) => {
              if (index == selection.length - 1) {
                this.$refs.publicTable.$refs.tableData.toggleRowSelection(it, true)
                return true
              } else {
                this.$refs.publicTable.$refs.tableData.toggleRowSelection(it, false)
                return false
              }
            })
            this.selectionList = newRows
          } else {
            this.selectionList = selection
          }
        },
        select: (selection, row) => {
          this.$refs.publicTable.$refs.tableData.clearSelection()
          this.$refs.publicTable.$refs.tableData.toggleRowSelection(row, true)
          this.$refs.publicTable.$refs.tableData.setCurrentRow(row)
          this.selectionList = []
          this.selectionList.push(row)
        }
      }

文章来源:https://blog.csdn.net/Achong999/article/details/135223485
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。