From 4ac22efb0d5ceea32ed954b7744ab6f335bd51b7 Mon Sep 17 00:00:00 2001 From: DDDDD12138 <43703884+DDDDD12138@users.noreply.github.com> Date: Wed, 19 Feb 2025 21:30:51 +0800 Subject: [PATCH] fix(components): [select] ensure scrollbar syncs when scrolling to selected option (#19636) * fix: ensure scrollbar syncs when scrolling to selected option * feat: update scrollbar when drop-down menu is displayed --- packages/components/select/src/useSelect.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/components/select/src/useSelect.ts b/packages/components/select/src/useSelect.ts index 450d5a3d54..b0b74bf393 100644 --- a/packages/components/select/src/useSelect.ts +++ b/packages/components/select/src/useSelect.ts @@ -708,7 +708,10 @@ export const useSelect: useSelectType = (props: ISelectProps, emit) => { const handleMenuEnter = () => { states.isBeforeHide = false - nextTick(() => scrollToOption(states.selected)) + nextTick(() => { + scrollbarRef.value?.update() + scrollToOption(states.selected) + }) } const focus = () => {