zoukankan      html  css  js  c++  java
  • vue element-ui el-table 选择框单选修改

     
    <el-table
            ref="table"
            :data="tableData"
            style=" 100%"
            border
            @selection-change="handleSelectionChange"
            @select-all="selectAll"
        >
          <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>
    

        

    data() {
        return {
          data: [1, 2, 3],
          msg: '我是父组件里的信息',
    
          tableData: [
            {
              date: '2016-05-03',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1518 弄'
            }, {
              date: '2016-05-02',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1518 弄'
            }, {
              date: '2016-05-04',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1518 弄'
            }, {
              date: '2016-05-01',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1518 弄'
            }
          ],
          obj: {}, //保存当前选中内容
        }
      },
      methods: {
        handleSelectionChange(selection) {
          this.obj = selection[0];
    
          if (selection.length > 1) {
            this.$refs['table'].clearSelection();
            this.$refs['table'].toggleRowSelection(selection.pop());
          }
    
        },
    
        // 禁止全选按钮
        selectAll(){
          this.$refs['table'].clearSelection();
        }
      },
    

      

     

  • 相关阅读:
    asp.net HttpModule和HttpHandler
    Asp.Net生命周期和Http管道技术
    降低web服务器压力
    html里嵌入CSS的三种方式
    php实现简单视图模板(视图引擎)
    ASP.NET MVC路由配置
    igel udc2 config
    单IP、网络、别名管道限速的设置
    Apple SIP简介及在Clover中如何控制
    Hackintosh
  • 原文地址:https://www.cnblogs.com/Blogzlj/p/15166291.html
Copyright © 2011-2022 走看看