From ed9bb12ef81d467624cc1a3d2f330307db4a555a Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Fri, 11 Oct 2024 18:42:24 +0800 Subject: [PATCH] fix(components): [table] the last column shuld not allow drag (#18444) --- packages/components/table/src/table-header/event-helper.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/components/table/src/table-header/event-helper.ts b/packages/components/table/src/table-header/event-helper.ts index daf0fdc6a8..e3ef608e2e 100644 --- a/packages/components/table/src/table-header/event-helper.ts +++ b/packages/components/table/src/table-header/event-helper.ts @@ -121,13 +121,14 @@ function useEvent(props: TableHeaderProps, emit) { } const target = el?.closest('th') - if (!column || !column.resizable) return + if (!column || !column.resizable || !target) return if (!dragging.value && props.border) { const rect = target.getBoundingClientRect() const bodyStyle = document.body.style - if (rect.width > 12 && rect.right - event.pageX < 8) { + const isLastTh = target.parentNode?.lastElementChild === target + if (rect.width > 12 && rect.right - event.pageX < 8 && !isLastTh) { bodyStyle.cursor = 'col-resize' if (hasClass(target, 'is-sortable')) { target.style.cursor = 'col-resize'