Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-country-code-select

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-country-code-select

Country Code Select with Vue

  • 1.6.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

vue-country-code-select

Country Code Select with Vue.

Checkout Demo at Github pages.

Installation

  • yarn:
      yarn add vue-country-code-select
    
  • npm:
      npm i --save vue-country-code-select
    

Usage

  • Install as a global component:

    import Vue from "vue";
    import VueCountryCode from "vue-country-code-select";
    
    Vue.use(VueCountryCode);
    
  • In your component:

    <template>
    ...
       <vue-country-code
                      @onSelect="onSelect"
                      <!-- optional -->
                      :preferredCountries="['vn', 'us', 'gb']">
       </vue-country-code>
    ...
    <template>
    <script>
    export default {
      data() {
        return {
        };
      },
      methods: {
         onSelect({name, iso2, dialCode}) {
           console.log(name, iso2, dialCode);
         },
      },
    }
    </script>
    
  • Register the new field as a global component

Props

Property valueTypeDefault valueDescription
defaultCountrystring''Default country, will override the country fetched from IP address of user
searchPlaceholderTextstring''Default text - "Search country"
enableSearchFieldBoolean''Default "false"
disabledFetchingCountryBooleanfalseDisable fetching current country based on IP address of user
enabledCountryCodeBooleanfalseEnable country code in the input
enabledFlagsBooleantrueEnable flags in the input
preferredCountriesArray[]Preferred countries list, will be on top of the dropdown. ie ['AU', 'BR']
onlyCountriesArray[]List of countries will be shown on the dropdown. ie ['AU', 'BR']
ignoredCountriesArray[]List of countries will NOT be shown on the dropdown. ie ['AU', 'BR']
dropdownOptionsObject{ disabledDialCode: false }Options for dropdown, supporting disabledDialCode

Events

Property valueArgumentsDescription
onSelectObjectFires when the input changes with the argument is the object includes { name, iso2, dialCode }

Highlights & Credits

Demo Usage


# install dependencies
$ yarn/npm install

# compile demo and start serve for development
$ yarn/npm dev

# build
$ yarn/npm build

Made by Mon.

Keywords

FAQs

Package last updated on 19 Jan 2021

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc