1.0.0 • Published 4 years ago

vuejs-phone-mask-input v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

@kai24/vue-phone-mask-input

Version License Monthly Downloads

example 1

Installation

yarn

yarn add vue-phone-mask-input

npm

npm i vue-phone-mask-input --save

Usage

import PhoneMaskInput from  "vue-phone-mask-input";
<template>
    <div>
      <h2>Example 4 [custom style]</h2>
      <phone-mask-input
        v-model="phone"
        autoDetectCountry
        showFlag
        @onValidate="onValidate"
        wrapperClass="wrraper-example"
        inputClass="input-example"
        flagClass="flag-example"
      />
      <p>
        Phone number:
        <b>{{phone}}</b>
      </p>
      <p class="json">{{valid}}</p>
    </div>
</template>

example 2

Props

NameTypeDefaultDescription
valueString, NumberValue to be render in the input
placeholderString""Placeholder to be shown when no tags
autoDetectCountryBooleanfalseDetect visitor country
defaultCountryStringone of the values defined here
showFlagBooleanfalseShow country flag
flagSizeStringnormalAvailable values: small, normal, big
disabledBooleanfalseDisable input field
wrapperClassString{ display: flex; flex-direction: row; align-items: center; height: 40px; }Style class of div wrapper input and flag
inputClassString{ height: 20px; }Style class of input
flagClassString{ margin: 0; }Style class of flag (span tag)

Events

Property valueArgumentsDescription
inputStringFires when the input changes with the argument is the string number
isValidObjectFires when the input changes with the argument is the object includes { number, isValid, country }
onBlurFires on blur event
onFocusFires on focus event

Available Flags

Here follows the list of the available flags. They are identified using the ISO 3166-1 standard.
This component currently support alpha-2 of the standard.

Country Namealpha-2
Afghanistanaf
Aland Islandsax
Albaniaal
Algeriadz
American Samoaas
Andorraad
Angolaao
Anguillaai
Antigua and Barbudaag
Argentinaar
Armeniaam
Arubaaw
Australiaau
Austriaat
Azerbaijanaz
Bahamasbs
Bahrainbh
Bangladeshbd
Barbadosbb
Belarusby
Belgiumbe
Belizebz
Beninbj
Bermudabm
Bhutanbt
Boliviabo
Bosnia and Herzegovinaba
Botswanabw
Brazilbr
British Virgin Islandsvg
Bruneibn
Bulgariabg
Burkina Fasobf
Burmamm
Burundibi
Cambodiakh
Camerooncm
Canadaca
Canary Islandsic
Cape Verdecv
Cayman Islandsky
Central African Republiccf
Chadtd
Chilecl
Chinacn
Colombiaco
Comoroskm
Cook Islandsck
Costa Ricacr
Croatiahr
Cubacu
Curacaocw
Cypruscy
Czech Republiccz
Democratic Republic of the Congocd
Denmarkdk
Djiboutidj
Dominicadm
Dominican Republicdo
East Timortl
Ecuadorec
Egypteg
El Salvadorsv
Equatorial Guineagq
Eritreaer
Estoniaee
Ethiopiaet
European Unioneu
Falkland Islands (Malvinas)fk
Faroe Islandsfo
Fijifj
Finlandfi
Francefr
French Polynesiapf
French Southern Territoriestf
Gabonga
Gambiagm
Georgiage
Germanyde
Ghanagh
Gibraltargi
Granadagd
Greecegr
Greenlandgl
Guamgu
Guatemalagt
Guernseygg
Guineagn
Guinea-Bissaugw
Guyanagy
Haitiht
Hondurashn
Hong Konghk
Hungaryhu
Icelandis
Indiain
Indonesiaid
Iranir
Iraqiq
Irelandie
Isle of Manim
Israelil
Italyit
Ivory Coastci
Jamaicajm
Japanjp
Jerseyje
Jordanjo
Kazakhstankz
Kenyake
Kiribatiki
Kuwaitkw
Kyrgyzstankg
Laosla
Latvialv
Lebanonlb
Lesothols
Liberialr
Libyaly
Liechtensteinli
Lithuanialt
Luxembourglu
Macaomomac
Macedoniamk
Madagascarmg
Malawimw
Malaysiamy
Maldivesmv
Malimlmli
Maltamt
Marshall, Islandsmh
Martiniquemq
Mauriciomu
Mauritaniamr
Mayotteyt
Mexicomx
Micronesiafm
Moldovamd
Monacomc
Mongoliamn
Montenegrome
Montserratms
Moroccomamar
Mozambiquemzmoz
Namibiananam
Naurunrnru
Nepalnpnpl
Netherlands Antillesan
New Caledonianc
New Zealandnz
Nicaraguani
Nigerne
Nigeriang
Niuenu
Norfolk, Islandnf
North Koreakp
Northern Mariana Islandsmp
Norwayno
Omanom
Pakistanpk
Palaupw
Palestineps
Panamapa
Papua New Guineapg
Paraguaypypry
Perupeper
Philippinesph
Pitcairnpn
Polandpl
Portugalpt
Puerto Ricopr
Qatarqa
Republic of the Congocg
Romaniaro
Russiaru
Rwandarw
Saint Barthelemybl
Saint Helenash
Saint Kitts and Neviskn
Saint Lucialc
Saint Martinmf
Saint Vincent and the Grenadinesvc
Samoaws
San Marinosm
Sao Tome and Principest
Saudi Arabiasa
Senegalsn
Serbiars
Seychellessc
Sierra Leonesl
Singaporesg
Slovakiask
Sloveniasi
Solomon Islandssb
Somaliaso
South Africaza
South Georgia and the South Sandwich Islandsgs
South Koreakr
South Sudanss
Spaines
Sri Lankalk
Sudansd
Surinamesr
Swazilandsz
Swedense
Switzerlandch
Syriasy
Taiwantw
Tajikistantj
Tanzaniatz
Thailandth
The Netherlandsnl
Togotg
Tokelautk
Tongato
Trinidad and Tobagott
Tunisiatn
Turkeytr
Turkmenistantm
Turks and Caicos Islandstc
Tuvalutv
Ugandaug
Ukraineua
United Arab Emiratesae
United Kingdomgb
United Statesus
Uruguayuy
Uzbekistanuz
Vanuatuvu
Vatican Cityva
Venezuelave
Vietnamvn
Virgin Islands of the United Statesvi
Wallis and Futunawf
Western Saharaeh
Yemenye
Zambiazm
Zimbabwezw