Skip to content

Commit 750cb3a

Browse files
authored
fix:修复单行文本域与输入框高度不一致 (#3580)
1 parent 636516b commit 750cb3a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

packages/renderless/src/input/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,16 @@ export const calcTextareaHeight =
153153
minHeight = minHeight + paddingSize + borderSize
154154
}
155155

156-
if (props.size) {
156+
if (props.size || minRows === 1) {
157157
minHeight = props.size === 'mini' ? minHeight * 0.67 : props.size === 'small' ? minHeight : minHeight * 1.17
158158
}
159159

160160
if (props.height) {
161161
minHeight = props.height
162162
}
163-
164163
if (!state.isDisplayOnly) {
165164
height = Math.max(minHeight, height)
166-
textareaStyle.minHeight = `${minHeight}px`
165+
textareaStyle.minHeight = `${Math.floor(minHeight)}px`
167166
} else {
168167
textareaStyle.minHeight = `0px`
169168
}

packages/vue/src/input/src/mobile-first.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@
323323
ref="textarea"
324324
v-bind="a($attrs, ['type', 'class', 'style', '^on[A-Z]'])"
325325
:tabindex="tabindex"
326-
class="block w-full border-0 h-8 sm:h-7 xs:h-6 sm:border-solid sm:border-color-border sm:hover:border-color-border-hover sm:focus:border-color-brand-focus sm:disabled:border-color-border outline-0 rounded placeholder:text-color-text-placeholder placeholder:text-sm sm:disabled:placeholder:text-color-text-disabled text-sm text-color-text-primary bg-color-bg-1 disabled:cursor-not-allowed disabled:text-color-text-disabled sm:disabled:text-color-text-disabled sm:disabled:bg-color-bg-6"
326+
class="block w-full border-0 sm:border-solid sm:border-color-border sm:hover:border-color-border-hover sm:focus:border-color-brand-focus sm:disabled:border-color-border outline-0 rounded placeholder:text-color-text-placeholder placeholder:text-sm sm:disabled:placeholder:text-color-text-disabled text-sm text-color-text-primary bg-color-bg-1 disabled:cursor-not-allowed disabled:text-color-text-disabled sm:disabled:text-color-text-disabled sm:disabled:bg-color-bg-6"
327327
:class="[
328328
readonly ? 'sm:border-0 px-0 py-0' : 'sm:border px-3 ',
329329
state.isDisplayOnly ? 'hidden' : '',

0 commit comments

Comments
 (0)