fix: delete Popconfirm being obscured by fixed columns (#6118)
* fix: delete Popconfirm being obscured by fixed columns * fix: opened popConfirm will prevent the table from scrolling --------- Co-authored-by: Netfan <netfan@foxmail.com>
This commit is contained in:
parent
cc6c9bf7a0
commit
5949c73a30
@ -208,22 +208,34 @@ setupVbenVxeTable({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderConfirm(opt: Recordable<any>) {
|
function renderConfirm(opt: Recordable<any>) {
|
||||||
|
let viewportWrapper: HTMLElement | null = null;
|
||||||
return h(
|
return h(
|
||||||
Popconfirm,
|
Popconfirm,
|
||||||
{
|
{
|
||||||
getPopupContainer(el) {
|
/**
|
||||||
return (
|
* 当popconfirm用在固定列中时,将固定列作为弹窗的容器时可能会因为固定列较窄而无法容纳弹窗
|
||||||
el
|
* 将表格主体区域作为弹窗容器时又会因为固定列的层级较高而遮挡弹窗
|
||||||
.closest('.vxe-table--viewport-wrapper')
|
* 将body或者表格视口区域作为弹窗容器时又会导致弹窗无法跟随表格滚动。
|
||||||
?.querySelector('.vxe-table--main-wrapper')
|
* 鉴于以上各种情况,一种折中的解决方案是弹出层展示时,禁止操作表格的滚动条。
|
||||||
?.querySelector('tbody') || document.body
|
* 这样既解决了弹窗的遮挡问题,又不至于让弹窗随着表格的滚动而跑出视口区域。
|
||||||
);
|
*/
|
||||||
|
getPopupContainer() {
|
||||||
|
viewportWrapper = el.closest('.vxe-table--viewport-wrapper');
|
||||||
|
return document.body;
|
||||||
},
|
},
|
||||||
placement: 'topLeft',
|
placement: 'topLeft',
|
||||||
title: $t('ui.actionTitle.delete', [attrs?.nameTitle || '']),
|
title: $t('ui.actionTitle.delete', [attrs?.nameTitle || '']),
|
||||||
...props,
|
...props,
|
||||||
...opt,
|
...opt,
|
||||||
icon: undefined,
|
icon: undefined,
|
||||||
|
onOpenChange: (open: boolean) => {
|
||||||
|
// 当弹窗打开时,禁止表格的滚动
|
||||||
|
if (open) {
|
||||||
|
viewportWrapper?.style.setProperty('pointer-events', 'none');
|
||||||
|
} else {
|
||||||
|
viewportWrapper?.style.removeProperty('pointer-events');
|
||||||
|
}
|
||||||
|
},
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
attrs?.onClick?.({
|
attrs?.onClick?.({
|
||||||
code: opt.code,
|
code: opt.code,
|
||||||
|
Loading…
Reference in New Issue
Block a user