Commit c21a814287809a30ff32987b81eac0c0ee38edee
1 parent
593742af
feat($input-number): add events 'on-focus', 'on-blur', 'on-enter' for input-number component
Showing
1 changed file
with
4 additions
and
0 deletions
Show diff stats
src/components/input-number/input-number.vue
| @@ -238,9 +238,11 @@ | @@ -238,9 +238,11 @@ | ||
| 238 | }); | 238 | }); |
| 239 | }, | 239 | }, |
| 240 | focus () { | 240 | focus () { |
| 241 | + this.$emit('on-focus'); | ||
| 241 | this.focused = true; | 242 | this.focused = true; |
| 242 | }, | 243 | }, |
| 243 | blur () { | 244 | blur () { |
| 245 | + this.$emit('on-blur'); | ||
| 244 | this.focused = false; | 246 | this.focused = false; |
| 245 | }, | 247 | }, |
| 246 | keyDown (e) { | 248 | keyDown (e) { |
| @@ -250,6 +252,8 @@ | @@ -250,6 +252,8 @@ | ||
| 250 | } else if (e.keyCode === 40) { | 252 | } else if (e.keyCode === 40) { |
| 251 | e.preventDefault(); | 253 | e.preventDefault(); |
| 252 | this.down(e); | 254 | this.down(e); |
| 255 | + } else if (e.keyCode === 13) { | ||
| 256 | + this.$emit('on-enter'); | ||
| 253 | } | 257 | } |
| 254 | }, | 258 | }, |
| 255 | change (event) { | 259 | change (event) { |