Socket
Socket
Sign inDemoInstall

@kingscode/vuetify-phone-input

Package Overview
Dependencies
12
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @kingscode/vuetify-phone-input

A Vuetify form control usable for phone numbers. Supports country code, auto formatting and country code recognition


Version published
Weekly downloads
196
increased by41.01%
Maintainers
4
Created
Weekly downloads
 

Readme

Source

Vuetify Phone Input

Example

Vuetify Phone Input

Please refer to the TextField if you want to see which inherited props will be available.

Props

NameTypeDefault
valuestring''
countries[]countries
typestringtel
placeholderstring#
countryCodestring-number''
prependCountryCodebooleantrue

Events:

NameReturn valueWhat
@countrystringThe new selected country code
@phonestringEquivalent to @change event, but with additional features. Gets called on blur

Installation

install the dependency

npm i @kingscode/vuetify-phone-input

Then just import the component in the file you need it

import VuetifyPhoneInput from '@kingscode/vuetify-phone-input';

And add it to the components in your vue file

  components: {
    VuetifyPhoneInput,
    ...

Usage

<template>
    <div>
        <VuetifyPhoneInput :countries="countries"
                           @country="onCountry"
                           @phone="onPhone"/>
    </div>
</template>

<script lang="js">
import VuetifyPhoneInput from '@kingscode/vuetify-phone-input';

export default {
    name: 'Home',
    components: {
        VuetifyPhoneInput
    },
    computed: {
        countries: () => [ // we can now provide our own list of countries + codes. Defaults to all possible countries.
            {
                code: 31,
                name: 'NL',
            },
            {
                code: 32,
                name: 'BE',
            },
        ],
    },
    methods: {
        onCountry(country) { // callback when the consumer changed the country code.
            console.log(country); // 32
        },
        onPhone(phone) { // callback when the consumer changed the phone number
            console.log(phone); // +31612345678
        },
    },
};
</script>

If the consumer enters the following: +32612345678 when the current selected country does not match, the country will be adjusted accordingly.

Remember that this Phone Input is derived from the VTextField from Vuetify, meaning that you can still use the error-messages, or placeholder attributes for example.

Keywords

FAQs

Last updated on 23 Nov 2020

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc