Skip to content

Commit

Permalink
feat: 双击数据行空白区域,打开detail
Browse files Browse the repository at this point in the history
  • Loading branch information
NMTuan committed Jul 14, 2023
1 parent db9362c commit d35330a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pages/manager/[...key].vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
:width="width" :height="height">
<template #cell="{ column, columns, columnIndex, depth, style, rowData, rowIndex }">
<div class="flex items-center flex-1 h-full text-sm overflow-hidden px-2"
@click="handlerCellClick({ rowIndex })">
@click="handlerCellClick({ rowIndex })" @dblclick="handlerCellDblclick()">
<div class="truncate">{{ rowData[column.title] }}</div>
</div>
</template>
Expand Down Expand Up @@ -113,6 +113,15 @@ const handlerCellClick = ({ rowIndex }) => {
currentRowIndex.value = rowIndex
}
// 单元格的双击事件
const handlerCellDblclick = () => {
// 如果未选择内容,则打开详情
const selected = window.getSelection().toString()
if (selected.trim() === '') {
detailVisible.value = true
}
}
// 处理row的样式
const handlerRowClass = ({ rowIndex }) => {
if (currentRowIndex.value === rowIndex) {
Expand Down

0 comments on commit d35330a

Please sign in to comment.