<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<!-- 处理table的复选框选中和取消选中,包含多个表格的情况
1.首先要确认时选中还是取消选中,这个可以通过判断当前行是否在选中的数组中来判断
-->
<!-- 处理table至少选择一个,当table剩下最后一个的时候,不允许取消 -->
<div id="app">
<el-table ref="multipleTable1" :data="tableData" tooltip-effect="dark" style="width: 100%"
@selection-change="handleSelectionChange" @select = "handleSelect" @row-click="rowClick">
<el-table-column type="selection" width="55">
</el-table-column>
<el-table-column label="日期" width="120">
<template slot-scope="scope">{
{ scope.row.date }}</template>
</el-table-column>
<el-table-column prop="name" label="姓名" width="120">
</el-table-column>
<el-table-column prop="address" label="地址" show-overflow-tooltip>
</el-table-column>
</el-table>
<div style="margin-top: 20px">
<el-button>切换第二、第三行的选中状态</el-button>
<el-button>取消选择</el-button>
</div>
多个表格多选复选框的勾选、取消、至少保留一个勾选状态
最新推荐文章于 2025-03-14 15:15:59 发布