Commit 9e7a37403b676268bc3e1838aae1fe0f3775b407

Authored by xingbofeng
1 parent 3e4bab96

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,6 +19,9 @@
19 :number="number" 19 :number="number"
20 :autofocus="autofocus" 20 :autofocus="autofocus"
21 @keyup.enter="handleEnter" 21 @keyup.enter="handleEnter"
  22 + @keyup="handleKeyup"
  23 + @keypress="handleKeypress"
  24 + @keydown="handleKeydown"
22 @focus="handleFocus" 25 @focus="handleFocus"
23 @blur="handleBlur" 26 @blur="handleBlur"
24 @input="handleInput" 27 @input="handleInput"
@@ -39,6 +42,9 @@ @@ -39,6 +42,9 @@
39 :value="value" 42 :value="value"
40 :autofocus="autofocus" 43 :autofocus="autofocus"
41 @keyup.enter="handleEnter" 44 @keyup.enter="handleEnter"
  45 + @keyup="handleKeyup"
  46 + @keypress="handleKeypress"
  47 + @keydown="handleKeydown"
42 @focus="handleFocus" 48 @focus="handleFocus"
43 @blur="handleBlur" 49 @blur="handleBlur"
44 @input="handleInput"> 50 @input="handleInput">
@@ -154,6 +160,15 @@ @@ -154,6 +160,15 @@
154 handleEnter (event) { 160 handleEnter (event) {
155 this.$emit('on-enter', event); 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 handleIconClick (event) { 172 handleIconClick (event) {
158 this.$emit('on-click', event); 173 this.$emit('on-click', event);
159 }, 174 },