diff --git a/components/input-data/input-data.vue b/components/input-data/input-data.vue index 1a8cb9093eb8be4b057bee8439ee9e102e6f3b2c..fff9edc921ae84e03c1f5e93c7a4a26cd33a09d8 100644 --- a/components/input-data/input-data.vue +++ b/components/input-data/input-data.vue @@ -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 @@ {{title}} - + + @confirm="confirm" @blur="blur" @focus="focus"/> @@ -94,4 +107,4 @@ align-self: center; margin-right: 10rpx; } - \ No newline at end of file + diff --git a/static/icons/clear.png b/static/icons/clear.png index 5dd604c3ea31bde787e8b58093ebbf40f8131bdf..d22c2bfad26f35b90c49c0cbc1fa2d4b138f37b0 100644 Binary files a/static/icons/clear.png and b/static/icons/clear.png differ