zoukankan      html  css  js  c++  java
  • element表格实现复选框单选

    默认表格前面的复选框是可以选择多个,但有的需求是只能选择一个,

    可以通过clearSelection和toggleRowSelection去实现,把当前选中的这条selected设置成true。

         <div class="same-table">
               <el-table
                   :data="tableData"
                   class="oneTabel"
                   ref="multipleTable"
                   border
                   fit
                   @selection-change="handleSelectionChange"
                   @select-all="dialogCheck"
                   @select="dialogCheck"
                   style="100%;">
                       <el-table-column type="selection" width="50"></el-table-column>
                       <el-table-column type="index" width="60" label="序号"></el-table-column>
                       <el-table-column prop="name" label="机构"></el-table-column>
                       <el-table-column prop="negativeDec" label="负面清单描述"></el-table-column>
               </el-table>
           </div>
    

      

    methods: {
           handleSelectionChange(val) {
                console.log(val, 'val')
                this.multipleSelection = val;
            },
            dialogCheck: function(selection, row) {
                console.log(selection, row);
                this.$refs.multipleTable.clearSelection()
                if (selection.length === 0) { 
                    return
                }
                if (row) {
                    this.selectioned = row
                    this.$refs.multipleTable.toggleRowSelection(row, true)
                }
            }
    }
    

      

  • 相关阅读:
    (转)使用InfluxDB+cAdvisor+Grafana配置Docker监控
    Linux cut命令
    php 三种数组
    Linux httpd源码编译安装
    Linux yum如何下载rpm包到本地
    linux yum 工具
    windows phpstudy 本地添加自定义域名
    php.ini
    Linux rpm 查询
    linux rpm 安装和卸载
  • 原文地址:https://www.cnblogs.com/theblogs/p/14350375.html
Copyright © 2011-2022 走看看