You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vue1.0.26line4721this.on('compositionend',function(){composing=false;// in IE11 the "compositionend" event fires AFTER// the "input" event, so the input handler is blocked// at the end... have to call it here.//// #1327: in lazy mode this is unecessary.if(!lazy){self.listener();}});
当autocomplete遇到中文输入法
1.需求场景
常见的搜索输入框,输入一个字符之后会调用后台的服务传入关键字进行查询。
以往实现,监听输入框的keydown/change事件,当输入参数改变的时候触发keydown事件,获取当前输入的参数然后调用后端服务。
1.1弊端:
1.2 html5 oninput事件
关于oninput事件
1.3 实践
查看demo地址
1.4 But Doesn't work In Vue 1.0.26
翻开vue2.1.4 的源码
原来在compositionend之后手动触发了input方法
再打开vue 1.0.26的源码
似乎好像明白了什么
input + compositionend 来联合解决这个问题
查看demo地址
1.5 回过头来看compositionevent
复合事件
复合事件(composition event)是DOM3级事件中新添加的一类事件,用于处理IME的输入序列。IME(Input Method Editor,输入法编辑器)可以让用户输入在物理键盘上找不到的字符。复合事件就是针对检测和处理这种输入而设计的。
compositionstart:在IME的文本复合系统打开时触发,表示要开始输入了。
compositionupdate:在向输入字段中插入新字符时触发。
compositionend:在IME的文本复合系统关闭时触发,表示返回正常键盘的输入状态。
The text was updated successfully, but these errors were encountered: