vux 踩坑笔记

一 ,vux的x-input组件中show-clear=“true”清除icon点击无效

原文链接:https://blog.csdn.net/L_shouzi/article/details/99955927

1.vux 目前是2.6版本以上才出现这个问题,可以选择版本回退 

2. 修改源码 但是注意每次运行install 是 都需要重新修改回来 步骤如下(我是在vue-cli中使用的)

① 找到你的node_modues---vux---src--components---x-input --index.vue 组件

② 修改一下三处 methods 中的 focus 、 onBlur、 onKeyUp 

代码如下:将三处改为异步执行 即可

       focus () {
        // 优化添加
        setTimeout(() => {
            this.$refs.input.focus()
        }, 0) 
        },
        onBlur ($event) {
            this.setTouched()
            this.validate()
             // 优化添加
             setTimeout(() => {
                this.isFocus = false
            }, 0)
            this.$emit('on-blur', this.currentValue, $event)
        },
        onKeyUp (e) {
            if (e.key === 'Enter') {
            e.target.blur()
            this.isFocus = true  //优化添加
            this.$emit('on-enter', this.currentValue, e)
            }
        }
原文地址:https://www.cnblogs.com/shichenzi/p/11730629.html