您当前的位置: 首页 > 

暂无认证

  • 0浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

vue+element+table多选手动取消选中

发布时间:2022-01-05 15:04:27 ,浏览量:0

目录
  • 1、HTML部分
  • 2、JavaScript部分
1、HTML部分
<el-table ref="refSelect" :data="dataList" @select="selectRow" @select-all="selectAll" > <el-table-column type="selection" width="55" align="center">{ scope.row.status == 0 ? "在线" : "离线" }} data() { return { dataList: [ { id: 1, names: '半晨', age: 24, type: 1, status: 0 }, { id: 2, names: '舒冬', age: 37, type: 1, status: 1 }, { id: 3, names: '舒晨', age: 36, type: 2, status: 1 } ], selectValue: [] } }, methods: { // 单行选择 selectRow(row) { this.handleSelect(row); }, // 全选/反全选 selectAll(row) { this.handleSelect(row); }, // 处理选择 handleSelect(row) { row.reduce((beforeVal, afterVal) => { if (beforeVal.type != afterVal.type) { row = []; this.selectValue = []; this.$refs.refSelect.clearSelection(); return this.$message.warning("请选择相同类型的数据"); } this.selectValue = row; return afterVal; }); } } } 
关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.5219s