Skip to content

Commit 84662f2

Browse files
fix: 🐛 修复textarea在支付宝小程序上清除按钮点击热区失效的问题
1 parent be75747 commit 84662f2

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

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

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135

136136
@include e(suffix) {
137137
flex-shrink: 0;
138-
margin-left: $-textarea-icon-margin;
139138
line-height: initial;
140139
}
141140

@@ -144,10 +143,16 @@
144143
padding: 0;
145144
font-size: 0;
146145
background: $-textarea-bg;
146+
padding-right: 24px;
147+
box-sizing: border-box;
147148

148149
@include when(show-limit) {
149150
padding-bottom: 36px;
150151
}
152+
153+
@include when(suffix) {
154+
padding-right: calc($-textarea-icon-size + 8px);
155+
}
151156
}
152157

153158

@@ -167,14 +172,11 @@
167172
&::-webkit-input-placeholder {
168173
color: $-input-placeholder-color;
169174
}
170-
171-
@include when(suffix) {
172-
padding-right: calc($-textarea-icon-size + 8px);
173-
}
174175
}
175176

176177
@include e(suffix) {
177178
position: absolute;
179+
z-index: 1;
178180
right: 0;
179181
top: 0;
180182
bottom: 0;
@@ -185,8 +187,6 @@
185187
font-size: $-textarea-icon-size;
186188
color: $-textarea-icon-color;
187189
background: $-textarea-bg;
188-
// vertical-align: middle;
189-
// line-height: $-cell-line-height;
190190
}
191191

192192
@include edeep(clear) {
@@ -312,11 +312,6 @@
312312
display: none;
313313
}
314314

315-
316-
.wd-textarea__inner {
317-
padding-right: 24px;
318-
}
319-
320315
.wd-textarea__suffix {
321316
right: 0;
322317
}

src/uni_modules/wot-design-uni/components/wd-textarea/wd-textarea.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<view :class="rootClass" :style="customStyle" @click="handleClick">
2+
<view :class="rootClass" :style="customStyle">
33
<view v-if="label || useLabelSlot" :class="labelClass" :style="labelStyle">
44
<view v-if="prefixIcon || usePrefixSlot" class="wd-textarea__prefix">
55
<wd-icon v-if="prefixIcon && !usePrefixSlot" custom-class="wd-textarea__icon" :name="prefixIcon" @click="onClickPrefixIcon" />
@@ -12,9 +12,9 @@
1212
</view>
1313

1414
<!-- 文本域 -->
15-
<view :class="`wd-textarea__value ${customTextareaContainerClass} ${showWordCount ? 'is-show-limit' : ''}`">
15+
<view :class="`wd-textarea__value ${showClear ? 'is-suffix' : ''} ${customTextareaContainerClass} ${showWordCount ? 'is-show-limit' : ''}`">
1616
<textarea
17-
:class="`wd-textarea__inner ${showClear ? 'is-suffix' : ''} ${customTextareaClass}`"
17+
:class="`wd-textarea__inner ${customTextareaClass}`"
1818
v-model="inputValue"
1919
:show-count="false"
2020
:placeholder="placeholder || translate('placeholder')"
@@ -212,12 +212,15 @@ function clear() {
212212
.then(() => requestAnimationFrame())
213213
.then(() => requestAnimationFrame())
214214
.then(() => {
215-
isFocus.value = true
216215
emit('change', {
217216
value: ''
218217
})
219218
emit('update:modelValue', inputValue.value)
220219
emit('clear')
220+
221+
requestAnimationFrame().then(() => {
222+
isFocus.value = true
223+
})
221224
})
222225
}
223226
// 失去焦点时会先后触发change、blur,未输入内容但失焦不触发 change 只触发 blur

0 commit comments

Comments
 (0)