Vux: [Bug Report] xinput 点击清除按钮时触发没有清除数据 提供的click事件也没有触发

Created on 11 Jun 2018  ·  9Comments  ·  Source: airyland/vux

VUX version

2.9.1

OS/Browsers version

安卓7.1.1(小米max2)

Vue version

2.4.2

Code

      <group>
        <x-input title="真实姓名" placeholder="请输入您的真实姓名" novalidate v-model="params.realName" @on-click-clear-icon="aaa" :show-clear="true" required name="realName">
        </x-input>
      </group>

Steps to reproduce

1.input中输入 2.点击清除按钮

What is Expected?

清除数据

What is actually happening?

没有清除数据

All 9 comments

点击清除按钮会先触发onBlur->this.isFocus = false,导致清除按钮隐藏而无法触发清除事件,去掉

是不是可以考虑 blur 时延迟一点设置 isFocus?

   onBlur ($event) {
      this.setTouched()
      this.validate()
      setTimeout(() => {
        this.isFocus = false
      }, 300)
      this.$emit('on-blur', this.currentValue, $event)
    },

按照zhouhh和kylexie的方案试了,都有些问题,最终综合改进了下,不知道有其它bug不。
zhouhh的方案,如果没有focus此时清除按钮不会消失。kylexie的方案,如果点击了清除,继续输入,此时清除图表消失了。我的方案是采用的kylexie,把时间改短了些,然后在onKeyUp中添加else{ this.isFocus = true}。仅供参考

找到源码,把click事件改为touchend就可以了

我也遇到了同样的问题....目前还没头绪

我也遇到了同样的问题....目前还没头绪

找到对应源码,将click事件改为touchend事件就可以了,如果你们线上不会重新npm install的话。

@vueProgrammer 3q, 按照大佬说的方式,搞定 ,灰常感蟹😃

我也遇到了同样的问题....目前还没头绪

找到对应源码,将click事件改为touchend事件就可以了,如果你们线上不会重新npm install的话。

确实有点效果感谢,但是新的问题来了...如果右侧出现错误icon,此时点x竟然也不会清除,但是如果没有那个错误icon,点x可以清除..晕了 请问遇到过吗?
谷歌浏览器出现这个问题,但是手机上没有出现 哈哈哈谢谢谢 包括ios和安卓 谢谢谢~

用以下方法,在blur时增加一个延迟,再在Clear加一个延迟,能解决此问题。
不知道有没有跟其它有冲突。

    clear () {
      this.currentValue = ''
      this.$emit('on-click-clear-icon')
      setTimeout(() => {
        this.focus()
        this.isFocus = true
      }, 250)
    },
    onBlur ($event) {
      this.setTouched()
      this.validate()
      setTimeout(() => {
        this.isFocus = false
        this.$emit('on-blur', this.currentValue, $event)
      }, 200)
    },
Was this page helpful?
0 / 5 - 0 ratings

Related issues

hjmmc picture hjmmc  ·  3Comments

FlyArtist picture FlyArtist  ·  3Comments

prettybot picture prettybot  ·  3Comments

mymmoonoa picture mymmoonoa  ·  4Comments

felixjing picture felixjing  ·  4Comments