el-table中单选功能

时间:2025-01-19 15:56:32
 <el-table
                ref="singleTable"
                :data="allShopData"
                :header-cell-class-name="headerCellStyle"
                tooltip-effect="dark"
                style="width: 100%"
                @select="selectChange"
                @selection-change="handleSelectionChange"
              >
                <el-table-column type="selection" width="55"> </el-table-column>
// 多选框选中数据
      handleSelectionChange(selection) {
         = selection;
         = ((item) => );
         = !;
      },
  
      // 单选框选中的数据 
      selectChange(selection) {
        if ( > 1) {
          const del_row = ();
          this.$(del_row, false);
        }
        (selection);
         = selection;
      },
select 当用户手动勾选数据行的 Checkbox 时触发的事件 selection, row