Vux: xInput组件show-clear点击时,如何添加事件 ?

Created on 7 Apr 2018  ·  35Comments  ·  Source: airyland/vux

xInput组件show-clear点击时,如何添加事件 ?

componenx-input

Most helpful comment

我现在用的x-input清除按钮不起作用,我添加这个事件@on-click-clear-icon也不起作用,啥情况,求解

All 35 comments

不支持。什么需求需要在这里作自定义处理?

你这个内容其实是跟 value 绑定的,foucs 时就是将内容置为空,你 watch 下 value,当值为空时做你的操作就可以了。

我现在用的x-input清除按钮不起作用,我添加这个事件@on-click-clear-icon也不起作用,啥情况,求解

之前用的是可以的,过了一段时间不能用了x-input清除按钮不起作用

我也是,x-input清除按钮不起作用

我也是,x-input清除按钮不起作用, @on-click-clear-icon事件也不起作用

我之前刚用的时候可以用,但是不清楚为啥现在不能用了,我干脆不用这个组件了,麻烦死了

发自我的iPhone

------------------ 原始邮件 ------------------
发件人: nollyhi notifications@github.com
发送时间: 2019年4月24日 17:19
收件人: airyland/vux vux@noreply.github.com
抄送: Michelle 1084836584@qq.com, Comment comment@noreply.github.com
主题: 回复:[airyland/vux] xInput组件show-clear点击时,如何添加事件 ? (#2603)

我也是,x-input清除按钮不起作用, @on-click-clear-icon事件也不起作用


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

我也是,x-input清除按钮不起作用, @on-click-clear-icon事件也不起作用。使用的版本是:2.9.2

我现在都不用vux太坑了

发自我的iPhone

------------------ 原始邮件 ------------------
发件人: dwz notifications@github.com
发送时间: 2019年4月28日 16:39
收件人: airyland/vux vux@noreply.github.com
抄送: Michelle 1084836584@qq.com, Comment comment@noreply.github.com
主题: 回复:[airyland/vux] xInput组件show-clear点击时,如何添加事件 ? (#2603)

我也是,x-input清除按钮不起作用, @on-click-clear-icon事件也不起作用。使用的版本是:2.9.2


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

清除按钮失效原因(安卓机情况下):
1、点击清除按钮时会先执行onBlur。其中将isFocus赋值为false
2、此时会先判定按钮不可见,然后其实就没有出发对应的clear事件。
我尝试在onBlur方法中延迟isFocus的执行。
_onBlur ($event) {
this.setTouched()
this.validate()
setTimeout(function () {
this.isFocus = false
}, 100)

this.$emit('on-blur', this.currentValue, $event)
},_

后面在安卓机中正常。
但是我这样做可能不是最好的方法,如果有大手指,希望能进行一下其他的修复。

@airyland 希望大佬能修复下。

@wanghui5 可以先按我这样改下。可以用的。

你在哪写了,没找到啊,按照啥样改呢

------------------ 原始邮件 ------------------
发件人: "dingangang"notifications@github.com;
发送时间: 2019年4月29日(星期一) 上午10:56
收件人: "airyland/vux"vux@noreply.github.com;
抄送: "冰`泪\"1084836584@qq.com; "Comment"comment@noreply.github.com;
主题: Re: [airyland/vux] xInput组件show-clear点击时,如何添加事件 ? (#2603)

@airyland 希望大佬能修复下。


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

看见了,我不用这个vux了,最后我自己封装了一个

------------------ 原始邮件 ------------------
发件人: "dingangang"notifications@github.com;
发送时间: 2019年4月29日(星期一) 上午10:44
收件人: "airyland/vux"vux@noreply.github.com;
抄送: "冰`泪\"1084836584@qq.com; "Comment"comment@noreply.github.com;
主题: Re: [airyland/vux] xInput组件show-clear点击时,如何添加事件 ? (#2603)

清除按钮失效原因(安卓机情况下):
1、点击清除按钮时会先执行onBlur。其中将isFocus赋值为false
2、此时会先判定按钮不可见,然后其实就没有出发对应的clear事件。
我尝试在onBlur方法中延迟isFocus的执行。
onBlur ($event) {
this.setTouched()
this.validate()
setTimeout(function () {
this.isFocus = false
}, 100)
this.$emit('on-blur', this.currentValue, $event)
},

后面在安卓机中正常。
但是我这样做可能不是最好的方法,如果有大手指,希望能进行一下其他的修复。


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

点击清除Icon,可以清除了吗

目前为止,2.9.4点击icon还是不可以清除输入的内容,请问这个bug修复了吗?

到2019-6-8为止,清除按钮和 @on-click-clear-icon事件问题还是没有修复。我不知道我还能不能坚持下去,希望作者能即使修复。

到2019-6-26为止,清除按钮和 @on-click-clear-icon事件问题还是没有修复。我不知道我还能不能坚持下去,希望作者能即使修复。

这个目前还没解决

------------------ 原始邮件 ------------------
发件人: "bxxuz"notifications@github.com;
发送时间: 2019年6月26日(星期三) 下午2:19
收件人: "airyland/vux"vux@noreply.github.com;
抄送: "冰`泪\"1084836584@qq.com; "Mention"mention@noreply.github.com;
主题: Re: [airyland/vux] xInput组件show-clear点击时,如何添加事件 ? (#2603)

到2019-6-26为止,清除按钮和 @on-click-clear-icon事件问题还是没有修复。我不知道我还能不能坚持下去,希望作者能即使修复。


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

到2019-7-9为止,清除按钮和 @on-click-clear-icon事件问题还是没有修复。我不知道我还能不能坚持下去,希望作者能即使修复。

到2019-7-17为止,清除按钮和 @on-click-clear-icon事件问题还是没有修复。我不知道我还能不能坚持下去,希望作者能即使修复。

到2019-7-24为止,清除按钮和 @on-click-clear-icon事件问题还是没有修复。我不知道我还能不能坚持下去,希望作者能即使修复。

到2019-08-03为止,清除按钮和 @on-click-clear-icon事件问题还是没有修复。我不知道我还能不能坚持下去,希望作者能即使修复。

清除按钮失效原因(安卓机情况下):
1、点击清除按钮时会先执行onBlur。其中将isFocus赋值为false
2、此时会先判定按钮不可见,然后其实就没有出发对应的clear事件。
我尝试在onBlur方法中延迟isFocus的执行。
_onBlur ($event) { this.setTouched() this.validate() setTimeout(function () { this.isFocus = false }, 100) this.$emit('on-blur', this.currentValue, $event) },_

后面在安卓机中正常。
但是我这样做可能不是最好的方法,如果有大手指,希望能进行一下其他的修复。

请问下这是要改源码吗?怎么改?

清除按钮失效原因(安卓机情况下):
1、点击清除按钮时会先执行onBlur。其中将isFocus赋值为false
2、此时会先判定按钮不可见,然后其实就没有出发对应的clear事件。
我尝试在onBlur方法中延迟isFocus的执行。
_onBlur ($event) { this.setTouched() this.validate() setTimeout(function () { this.isFocus = false }, 100) this.$emit('on-blur', this.currentValue, $event) },_
后面在安卓机中正常。
但是我这样做可能不是最好的方法,如果有大手指,希望能进行一下其他的修复。

请问下这是要改源码吗?怎么改?

只要你使用FastClick 清除icon就应该会生效。

楼上说的使用FastClick方法,没看懂.我目前是把清除图标的显示条件改掉了.显示效果稍微不友好.
定位到vux的安装目录,私有or全局的node_modules\vux\src\components\x-input\index.vue
从文件开头搜索到的第一个isFocus就是清除按钮显示的条件,把isFocus的条件删除.
源代码:
<icon type="clear" v-show="!hasRightFullHeightSlot && !equalWith && showClear && currentValue !== '' && !readonly && !disabled && isFocus" @click.native="clear"></icon>
修改后:
<icon type="clear" v-show="!hasRightFullHeightSlot && !equalWith && showClear && currentValue !== '' && !readonly && !disabled" @click.native="clear"></icon>

到2019-09-18为止,清除按钮和 @on-click-clear-icon事件问题还是没有修复。我不知道我还能不能坚持下去,希望作者能即使修复。

楼上说的使用FastClick方法,没看懂.我目前是把清除图标的显示条件改掉了.显示效果稍微不友好.
定位到vux的安装目录,私有or全局的node_modules\vux\src\components\x-input\index.vue
从文件开头搜索到的第一个isFocus就是清除按钮显示的条件,把isFocus的条件删除.
源代码:
<icon type="clear" v-show="!hasRightFullHeightSlot && !equalWith && showClear && currentValue !== '' && !readonly && !disabled && isFocus" @click.native="clear"></icon>
修改后:
<icon type="clear" v-show="!hasRightFullHeightSlot && !equalWith && showClear && currentValue !== '' && !readonly && !disabled" @click.native="clear"></icon>

当你的vue项目中import FastClick from 'fastclick'之后 清除按钮就会生效

到2019-10-23为止,清除按钮和 @on-click-clear-icon事件问题还是没有修复。我不知道我还能不能坚持下去,希望作者能即使修复。准备弃坑了

别用了,还其他控件吧

------------------ 原始邮件 ------------------
发件人: "GQChen"<[email protected]>;
发送时间: 2019年10月23日(星期三) 下午5:37
收件人: "airyland/vux"<[email protected]>;
抄送: "冰`泪\"<[email protected]>; "Mention"<[email protected]>;
主题: Re: [airyland/vux] xInput组件show-clear点击时,如何添加事件 ? (#2603)

到2019-10-23为止,清除按钮和 @on-click-clear-icon事件问题还是没有修复。我不知道我还能不能坚持下去,希望作者能即使修复。准备弃坑了


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

到2019-11-22为止,清除按钮和 @on-click-clear-icon事件问题还是没有修复。我不知道我还能不能坚持下去,希望作者能即使修复。准备弃坑了

@MummyCuke 谢谢, 你这个方法, 试过时候, 使用chrome模拟移动端浏览器, 清除按钮生效了, 可是直接用Chrome打开不生效

npm install fastclick --save
在 main.js 引用
const FastClick = require('fastclick') FastClick.attach(document.body)

2019/12/28 清除按钮失效问题仍未修复,项目中使用fastclick解决了这个问题,望修复

@airyland 望大佬看看这个issue

不想改node_mod目录的可以劫持对应方法

// main.js 代码必须放在新建APP Vue实例之前
import { XInput } from 'vux'
XInput.methods.onBlur = function ($event) {
  this.setTouched()
  this.validate()
  setTimeout(() => {
    this.isFocus = false
    this.$emit('on-blur', this.currentValue, $event)
    this.blur()
  }, 10)
}
Was this page helpful?
0 / 5 - 0 ratings