<el-table
    ref="table"
    border
    :data="data"
    @row-click="on_select"
    @selection-change="on_selectsion">
        <el-table-column type="selection" align="center" width="55"/>
        <el-table-column label="姓名" align="center" prop="name" show-overflow-tooltip/>
        <el-table-column label="年龄" align="center" prop="age" show-overflow-tooltip/>
</el-table>
data(){
    return{
        data:[ {name:'张三',age:23 },{ name:'李四',age:25 } ],
    }
}
methods:{
    on_select(val){//点击行选中复选框
        this.$refs.table.toggleRowSelection(val);
    },
    on_selectsion(val){//选中复选框操作
        console.log(val)
    }
}

 

Logo

前往低代码交流专区

更多推荐