mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-11 00:54:55 +08:00
feat: Support table row selection (#10072)
This commit is contained in:
parent
536a5fc1a0
commit
d6f16cf700
1 changed files with 18 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
|||
@selection-change="handleSelectionChange"
|
||||
:max-height="tableHeight"
|
||||
@row-contextmenu="handleRightClick"
|
||||
@row-click="handleRowClick"
|
||||
>
|
||||
<slot></slot>
|
||||
<template #empty>
|
||||
|
@ -190,6 +191,23 @@ watch(
|
|||
{ immediate: true },
|
||||
);
|
||||
|
||||
function handleRowClick(row: any, column: any, event: MouseEvent) {
|
||||
if (!tableRef.value) return;
|
||||
const target = event.target as HTMLElement;
|
||||
|
||||
if (target.closest('.el-checkbox')) return;
|
||||
if (
|
||||
target.closest('button') ||
|
||||
target.closest('a') ||
|
||||
target.closest('.el-switch') ||
|
||||
target.closest('.table-link') ||
|
||||
target.closest('.cursor-pointer')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
tableRef.value.refElTable.toggleRowSelection(row);
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
clearSelects,
|
||||
sort,
|
||||
|
|
Loading…
Add table
Reference in a new issue