Commit 9a0757e34375b5b17b45119d1009e0605ad548a5
Committed by
GitHub
Merge pull request #1390 from xingbofeng/2.0
fix: add keyup, keydown, keypress eventlistener of input component
Showing
1 changed file
with
15 additions
and
0 deletions
Show diff stats
src/components/input/input.vue
... | ... | @@ -19,6 +19,9 @@ |
19 | 19 | :number="number" |
20 | 20 | :autofocus="autofocus" |
21 | 21 | @keyup.enter="handleEnter" |
22 | + @keyup="handleKeyup" | |
23 | + @keypress="handleKeypress" | |
24 | + @keydown="handleKeydown" | |
22 | 25 | @focus="handleFocus" |
23 | 26 | @blur="handleBlur" |
24 | 27 | @input="handleInput" |
... | ... | @@ -39,6 +42,9 @@ |
39 | 42 | :value="value" |
40 | 43 | :autofocus="autofocus" |
41 | 44 | @keyup.enter="handleEnter" |
45 | + @keyup="handleKeyup" | |
46 | + @keypress="handleKeypress" | |
47 | + @keydown="handleKeydown" | |
42 | 48 | @focus="handleFocus" |
43 | 49 | @blur="handleBlur" |
44 | 50 | @input="handleInput"> |
... | ... | @@ -154,6 +160,15 @@ |
154 | 160 | handleEnter (event) { |
155 | 161 | this.$emit('on-enter', event); |
156 | 162 | }, |
163 | + handleKeydown (event) { | |
164 | + this.$emit('on-keydown', event); | |
165 | + }, | |
166 | + handleKeypress(event) { | |
167 | + this.$emit('on-keypress', event); | |
168 | + }, | |
169 | + handleKeyup (event) { | |
170 | + this.$emit('on-keyup', event); | |
171 | + }, | |
157 | 172 | handleIconClick (event) { |
158 | 173 | this.$emit('on-click', event); |
159 | 174 | }, | ... | ... |