Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(components): [cascader] consistent component height #10214

Merged
merged 1 commit into from Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 3 additions & 14 deletions packages/components/cascader/src/index.vue
Expand Up @@ -246,14 +246,6 @@ type tooltipType = InstanceType<typeof ElTooltip>
type inputType = InstanceType<typeof ElInput>
type suggestionPanelType = InstanceType<typeof ElScrollbar>

const DEFAULT_INPUT_HEIGHT = 40

const INPUT_HEIGHT_MAP = {
large: 36,
default: 32,
small: 28,
}

const popperOptions: Partial<Options> = {
modifiers: [
{
Expand Down Expand Up @@ -730,12 +722,9 @@ export default defineComponent({
watch(presentText, syncPresentTextValue, { immediate: true })

onMounted(() => {
const inputEl = input.value?.$el
inputInitialHeight =
inputEl?.offsetHeight ||
INPUT_HEIGHT_MAP[realSize.value] ||
DEFAULT_INPUT_HEIGHT
useResizeObserver(inputEl, updateStyle)
const inputInner = input.value!.input!
inputInitialHeight = inputInner.offsetHeight
useResizeObserver(inputInner, updateStyle)
})

return {
Expand Down
2 changes: 2 additions & 0 deletions packages/theme-chalk/src/cascader.scss
Expand Up @@ -8,6 +8,7 @@
@include set-component-css-var('cascader', $cascader);

display: inline-block;
vertical-align: middle;
position: relative;
font-size: getCssVar('font-size', 'base');
line-height: map.get($input-height, 'default');
Expand All @@ -21,6 +22,7 @@
}

.#{$namespace}-input {
display: flex;
cursor: pointer;

.#{$namespace}-input__inner {
Expand Down