div class=flex justify-end items-center style=margin-bottom var--el-card-padding; el-button type=danger plain click=handleBatchDeletei-ep-plus 批量删除el-button div el-table ref=dataTableRef
请尝试以下代码:
function handleBatchDelete() {
if (this.selectedRows.length > 0) {
// 遍历selectedRows进行删除操作
this.selectedRows.forEach(row => {
this.handleDelete(row.deptId);
});
// 清空选中的行数据
this.selectedRows = [];
}
}
在此代码中,我们检查selectedRows数组的长度是否大于0,如果是,则使用forEach循环遍历selectedRows数组,并调用handleDelete函数来删除每一行数据。最后,我们清空selectedRows数组以确保不再有选中的行数据。
原文地址: https://www.cveoy.top/t/topic/iApM 著作权归作者所有。请勿转载和采集!