📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

vue-intl-telephone-input

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-intl-telephone-input

Vue component for input international telephone numbers and validating.

1.0.1
Source
npm
Version published
Weekly downloads
18
Maintainers
1
Weekly downloads
 
Created
Source

vue-intl-telephone-input

Vue component for input international telephone numbers and validating.

Installation

  • yarn:
      yarn add vue-intl-telephone-input
    
  • npm:
      npm i --save vue-intl-telephone-input
    

Usage

  • Install as a global component:

    import IntlTelInput from 'vue-intl-telephone-input';
    
    Vue.component('intl-tel-input', IntlTelInput);
    
  • In your component:

    <template>
    ...
       <intl-tel-input :countryCode="'tw'" @validateSuccess="onSuccess"></intl-tel-input>
    ...
    <template>
    <script>
    export default {
      data() {
        return {
          phone: '',
        };
      },
      methods: {
        /**
         * @param {string} number
         * @param {string} country
         */
         onSuccess({ number, countryCode }) {
           console.log(number, countryCode);
         }
      },
    }
    </script>
    
  • Add a component:

    <template>
      <intl-tel-input :countryCode="'tw'"></intl-tel-input>
    </template>
    
    <script>
    import IntlTelInput from 'vue2-intl-tel-input';
    
    export default {
      name: 'Home',
      components: {
        IntlTelInput,
      }
    };
    </script>
    

Props

Property valueTypeDefault valueDescription
countryCodeString'tw'Default country. ex: 'tw', 'jp', 'kr'
dialCodeString''Enter a country dial code. ex: '886', '81', '82'
valueString''Enter a phone number
optionsObject{}Custom Options
options.separateDialCodeBooleanfalseSet use separate
options.customCssString''Set custom css name
options.inputObjectSet input attribute
options.input.requiredBooleanBooleanRequired property for HTML5 required attribute
options.input.readonlyBooleanBooleanSet readonly attribute
options.input.placeholderString''Set placeholder attribute

Events

Property valueArgumentsDescription
validateSuccessObjectFires when the input changes on validate success with the argument is the object includes { number, country }
validateErrorFires when the input changes on validate error

Keywords

vue

FAQs

Package last updated on 01 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts