<template>
<div class="newcom-wrap">
<el-table ref="multipleTable"
:data="newComList.list"
tooltip-effect="dark"
@selection-change="handleSelectionChange"
:row-key="getRowKey"
empty-text="数据正在加载……">
<el-table-column
type="selection"
width="55" :reserve-selection="true">
</el-table-column>
</el-table>
</div>
</template>
<script>
export default{
data(){
return {
getNewComForm:{
dataSource:0,
listId:'',
entId:[]
}
}
},
methods: {
getRowKey(row){
return row.id
},
handleSelectionChange(val) {//监听selection选择事件
this.getNewComForm.entId = []
for(let i in val){//去重以免发生意外的push
if(!this.getNewComForm.entId.includes(val[i].id)){
this.getNewComForm.entId.push(val[i].id)
}
}
}
}
}
</script>