vue-tel-input
International Telephone Input with Vue.
Checkout Demo at Codesandbox.
Installation
Usage
-
Import default CSS
to your project:
import 'vue-tel-input/dist/vue-tel-input.css';
-
Install as a global component:
import Vue from 'vue'
import VueTelInput from 'vue-tel-input'
Vue.use(VueTelInput)
-
In your component:
<template>
...
<vue-tel-input v-model="phone"
@onInput="onInput">
</vue-tel-input>
...
<template>
<script>
export default {
data() {
return {
phone: '',
};
},
methods: {
onInput({ number, isValid, country }) {
console.log(number, isValid, country);
},
},
}
</script>
Props
Property value | Type | Default value | Description |
---|
placeholder | string | Enter a phone number | Placeholder for the input |
disabledFetchingCountry | Boolean | false | Disable fetching current country based on IP address of user |
Events
Property value | Arguments | Description |
---|
onInput | Object | Fires when the input changes with the argument is the object includes { number, isValid, country } |
onBlur | | Fires on blur event |
Highlights & Credits
Demo Usage
$ yarn/npm install
$ yarn/npm dev
$ yarn/npm demo:open
$ yarn/npm dist:demo
$ yarn/npm dist
Contributors
made with ❤ by Steven.