vue+elementui实现批量删除

在el-table中手动添加一个el-table-column,设type属性为selection即可
tem

<el-table
    ref="multipleTable"
    :data="tableData"
    tooltip-effect="dark"
    style="width: 100%"
    @selection-change="handleSelectionChange">
     <el-table-column    //添加该子项
	      type="selection"
	      width="55">
      </el-table-column>
</el-table>

js

export default {
	data(){
        return{
            //批量删除选中id
            selectionList:[],
        }
    },
    methods:{
		//批量选择时触发
		handleSelectionChange(selection){
		    this.selectionList = []
		    selection.forEach(element => {
		        this.selectionList.push(element.id)
		    });
		},
	}
}

你可能感兴趣的:(vue)