Skip to content

Commit e487ced

Browse files
fix: 🐛 修复textarea、input的label存在icon时高度异常的问题
1 parent 25bd564 commit e487ced

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

src/pages/textarea/Index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<demo-block title="cell 类型" transparent>
2323
<wd-cell-group border>
24-
<wd-textarea label="高度自适应" auto-height clearable v-model="value5" placeholder="请输入..." prefix-icon="dong" />
24+
<wd-textarea label="高度自适应" auto-height clearable v-model="value5" placeholder="请输入..." prefix-icon="location" />
2525
<wd-textarea label="清空按钮" clearable v-model="value4" placeholder="请输入..." required />
2626
<wd-textarea label="字数限制" :maxlength="240" clearable show-word-limit v-model="value6" placeholder="请输入..." required />
2727
<wd-textarea label="只读" readonly clearable :maxlength="240" show-word-limit v-model="value12" placeholder="请输入..." required />

src/uni_modules/wot-design-uni/components/wd-input/index.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
@include when(cell) {
4949
background-color: $-dark-background2;
50+
line-height: $-cell-line-height;
5051

5152
@include when(border) {
5253
@include halfPixelBorder("top", $-input-cell-padding, $-dark-border-color);
@@ -96,6 +97,7 @@
9697

9798
@include e(label) {
9899
position: relative;
100+
display: flex;
99101
width: $-input-cell-label-width;
100102
color: $-cell-title-color;
101103
margin-right: $-cell-padding;
@@ -139,6 +141,7 @@
139141
@include e(prefix) {
140142
margin-right: $-input-icon-margin;
141143
font-size: $-input-fs;
144+
line-height: initial;
142145

143146
:deep(.wd-input__icon),
144147
:deep(.wd-input__clear) {
@@ -200,6 +203,8 @@
200203

201204
:deep(.wd-input__icon),
202205
:deep(.wd-input__clear) {
206+
display: inline-flex;
207+
align-items: center;
203208
height: $-input-cell-height;
204209
line-height: $-input-cell-height;
205210
}

src/uni_modules/wot-design-uni/components/wd-textarea/index.scss

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494

9595
@include e(label) {
9696
position: relative;
97+
display: flex;
9798
width: $-input-cell-label-width;
9899
color: $-cell-title-color;
99100
margin-right: $-cell-padding;
@@ -125,6 +126,7 @@
125126
@include e(prefix) {
126127
margin-right: $-textarea-icon-margin;
127128
font-size: $-textarea-fs;
129+
line-height: initial;
128130

129131
:deep(.wd-textarea__icon) {
130132
margin-left: 0;
@@ -160,6 +162,7 @@
160162
border: none;
161163
box-sizing: border-box;
162164
word-break: break-word;
165+
min-height: 24px;
163166

164167
&::-webkit-input-placeholder {
165168
color: $-input-placeholder-color;
@@ -182,8 +185,8 @@
182185
font-size: $-textarea-icon-size;
183186
color: $-textarea-icon-color;
184187
background: $-textarea-bg;
185-
vertical-align: middle;
186-
line-height: $-cell-line-height;
188+
// vertical-align: middle;
189+
// line-height: $-cell-line-height;
187190
}
188191

189192
@include edeep(clear) {
@@ -217,7 +220,7 @@
217220

218221
@include e(placeholder) {
219222
color: $-input-placeholder-color;
220-
223+
221224
&.is-error {
222225
color: $-input-error-color;
223226
}
@@ -233,7 +236,7 @@
233236
height: 100%;
234237
}
235238

236-
@include e(error-message){
239+
@include e(error-message) {
237240
color: $-form-item-error-message-color;
238241
font-size: $-form-item-error-message-font-size;
239242
line-height: $-form-item-error-message-line-height;
@@ -283,6 +286,7 @@
283286

284287
@include when(cell) {
285288
display: flex;
289+
line-height: $-cell-line-height;
286290

287291
&.is-error::after {
288292
background: $-textarea-cell-border-color;
@@ -293,6 +297,8 @@
293297
}
294298

295299
:deep(.wd-textarea__icon) {
300+
display: inline-flex;
301+
align-items: center;
296302
height: $-textarea-cell-height;
297303
line-height: $-textarea-cell-height;
298304
}

0 commit comments

Comments
 (0)