LouisMazel / vue-phone-number-input

A phone number input made with Vue JS (format & valid phone number)
https://louismazel.github.io/vue-phone-number-input
MIT License
607 stars 153 forks source link

✨ Add @keyup.enter method for enter button pressed on input #173

Closed saharhage closed 2 years ago

LouisMazel commented 2 years ago

The events keyup and keydown are already emitted by the component. Please, use one of these events like this :

<VuePhoneNumberInput @keyup.enter="yourFunc" />

Or

<VuePhoneNumberInput @keyup="keyupHandler" />

And something like that (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)

export default {
  methods: {
    keyupHandler(e) {
      if (e.key === 'Enter') {
        // submit your form
      }
    }
  }
}