提交 9c1b991c 编写于 作者: D DCloud_LXH

fix: clear.png、input-data clear-image 显示

上级 f6e3d819
......@@ -35,8 +35,7 @@
input: function (event : InputEvent) {
// @ts-ignore
this.inputClearValue = event.detail.value
// @ts-ignore
if (event.detail.value.length > 0) {
if ((this.inputClearValue as string).length > 0) {
this.showClearIcon = true
} else {
this.showClearIcon = false
......@@ -52,6 +51,20 @@
confirm(e : InputConfirmEvent) {
// this.$emit('confirm', this.getValue(e.detail.value))
},
blur() {
this.showClearIcon = false
},
focus() {
let inputValue = this.inputClearValue
if (typeof inputValue !== 'string') {
inputValue = inputValue.toString()
}
if ((inputValue as string).length > 0) {
this.showClearIcon = true
} else {
this.showClearIcon = false
}
},
getValue(value : any) : any {
switch (this.type) {
case 'number':
......@@ -70,9 +83,9 @@
<text class="uni-title-text"> {{title}} </text>
</view>
</view>
<view class="uni-input-wrapper input-wrapper uni-flex">
<view class="uni-input-wrapper input-wrapper">
<input class="uni-input" :type="inputType" :value="inputClearValue" :placeholder="title" @input="input"
@confirm="confirm" />
@confirm="confirm" @blur="blur" @focus="focus"/>
<image class="input-wrapper_image" src="/static/icons/clear.png" v-if="showClearIcon" @click="clearIcon">
</image>
</view>
......
static/icons/clear.png

5.5 KB | W: | H:

static/icons/clear.png

5.8 KB | W: | H:

static/icons/clear.png
static/icons/clear.png
static/icons/clear.png
static/icons/clear.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册