VUE+Element UI el-table点击行选中复选框
<el-tableref="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="姓名" al
·
<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)
}
}
更多推荐
已为社区贡献8条内容
所有评论(0)