diff --git a/packages/components/select/__tests__/select.test.ts b/packages/components/select/__tests__/select.test.ts index 2a6b461e75..3b0df0436f 100644 --- a/packages/components/select/__tests__/select.test.ts +++ b/packages/components/select/__tests__/select.test.ts @@ -2048,6 +2048,12 @@ describe('Select', () => { }, }) + Object.defineProperty(inputEl, 'clientHeight', { + get() { + return Number.parseInt(getComputedStyle(inputEl).height) + }, + }) + for (const size in sizeMap) { await wrapper.setProps({ size, diff --git a/packages/components/select/src/useSelect.ts b/packages/components/select/src/useSelect.ts index 59e52a27a9..a909948a52 100644 --- a/packages/components/select/src/useSelect.ts +++ b/packages/components/select/src/useSelect.ts @@ -383,7 +383,9 @@ export const useSelect = (props, states: States, ctx) => { const gotSize = getComponentSize(selectSize.value || form?.size) const sizeInMap = - gotSize === originClientHeight || originClientHeight <= 0 + selectSize.value || + gotSize === originClientHeight || + originClientHeight <= 0 ? gotSize : originClientHeight