Skip to content

Commit

Permalink
fix(input-number): fix overlap between step button and suffix/append (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
oljc authored Mar 1, 2024
1 parent 64cafb4 commit 9e01577
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/web-vue/components/input-number/input-number.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ export default defineComponent({
}
return (
<>
{slots.suffix?.()}
{slots.suffix && (
<div class={`${prefixCls}-suffix`}>{slots.suffix?.()}</div>
)}
<div class={`${prefixCls}-step`}>
<button
class={[
Expand Down
17 changes: 13 additions & 4 deletions packages/web-vue/components/input-number/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
}
}

.@{input-prefix-cls}-wrapper {
position: relative;
}

&-prefix,
&-suffix {
.transition();
Expand Down Expand Up @@ -92,13 +96,18 @@
&:not(.@{input-prefix-cls}-disabled):not(.@{input-prefix-cls}-outer-disabled) {
&:hover,
&:focus-within {
// 修正 hove 时存在 suffix 但隐藏了,视觉上 padding 过大问题
.@{input-prefix-cls}-suffix:has(.@{input-number-prefix-cls}-suffix) {
padding-left: @spacing-2;
}

& .@{input-number-prefix-cls}-step {
opacity: 1;
}

& ~ .@{input-prefix-cls}-suffix {
opacity: 0;
pointer-events: none;
}
& .@{input-number-prefix-cls}-suffix {
opacity: 0;
pointer-events: none;
}
}
}
Expand Down

0 comments on commit 9e01577

Please sign in to comment.