diff --git a/packages/virtual-list/src/components/scrollbar.ts b/packages/virtual-list/src/components/scrollbar.ts index 3898510cf3..bd3b373101 100644 --- a/packages/virtual-list/src/components/scrollbar.ts +++ b/packages/virtual-list/src/components/scrollbar.ts @@ -4,7 +4,7 @@ import { rAF, cAF } from '@element-plus/utils/raf' import isServer from '@element-plus/utils/isServer' import { NOOP } from '@vue/shared' -import { DefaultScrollBarProps, ScrollbarSizeKey, ScrollbarDirKey, SCROLLBAR_MIN_SIZE } from '../defaults' +import { DefaultScrollBarProps, SCROLLBAR_MIN_SIZE, HORIZONTAL } from '../defaults' import { renderThumbStyle } from '../utils' import { BAR_MAP } from '../../../scrollbar/src/util' @@ -36,11 +36,10 @@ const ScrollBar = defineComponent({ const trackStyle = computed(() => ({ display: props.visible ? null : 'none', position: 'absolute', - [ScrollbarSizeKey[props.layout]]: '6px', - [ScrollbarDirKey[props.layout]]: '2px', + width: HORIZONTAL === props.layout ? '100%' : '6px', + height: HORIZONTAL === props.layout ? '6px' : '100%', right: '2px', bottom: '2px', - height: '100%', borderRadius: '4px', }))