Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@keydown.enter在中文输入法输入字母出现候选字时按enter键会触发keydown事件,原生的.onkeydown此时并不会触发 #9850

Closed
shoung6 opened this Issue Apr 9, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@shoung6
Copy link

shoung6 commented Apr 9, 2019

Version

2.6.10

Reproduction link

https://jsfiddle.net/c6gufhno/

Steps to reproduce

1.光标聚焦在input1里,确保切换到中文输入法,随便输入几个字母出现中文候选字。此时按enter键把字母直接输入表单,会触发绑定的keydown事件
2.同样步骤在input2里,不会触发keydown事件

What is expected?

用vue的@keydown.enter表现与原生的绑定事件方式的表现一致

What is actually happening?

不一致


vue2.5.13并不会出现这个情况。
业务场景:表单有按enter键提交的功能。如果在中文输入法下输入了字母,然后想用enter键把字母输入到表单里,就会出现直接提交表单的情况。用户实际只是想把字母输入到表单里,并不想提交表单。

@shoung6 shoung6 changed the title @keydown.enter在中文输入法输入字母出现候选字时按enter键会触发down事件,原生的.onkeydown此时并不会触发 @keydown.enter在中文输入法输入字母出现候选字时按enter键会触发keydown事件,原生的.onkeydown此时并不会触发 Apr 9, 2019

@posva

This comment has been minimized.

Copy link
Member

posva commented Apr 9, 2019

The check done by Vue is checking other keys that contain the word enter using key and keyCode

@posva posva closed this Apr 9, 2019

@shoung6

This comment has been minimized.

Copy link
Author

shoung6 commented Apr 9, 2019

The check done by Vue is checking other keys that contain the word enter using key and keyCode

First of all, thank you for your answer. This situation is the same as what I said on the mac. But on windows, input1 and input2 behave consistently. Vue should ensure that mac is the same as windows.(Chinese:首先,谢谢你的回答。这种情况在mac上表现跟我说的一样。但是在windows上input1跟input2表现是一致的。vue应该保证mac跟windows表现一样吧)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.