8.3.1 • Published 11 days ago

vue-tel-input v8.3.1

Weekly downloads
32,523
License
MIT
Repository
github
Last release
11 days ago

vue-tel-input

International Telephone Input with Vue.

npm stars

Documentation and Demo

Visit the website

Vue 2 Support

vue-tel-input@legacy: Guide

Changelog

Go to Github Releases

Getting started

  • Install the plugin:

    npm install vue-tel-input
  • Add the plugin into your app:

    import Vue from 'vue';
    import VueTelInput from 'vue-tel-input';
    import 'vue-tel-input/vue-tel-input.css';
    
    const app = createApp(App);
    app.use(VueTelInput);
    app.mount('#app');

    More info on installation

  • Use the vue-tel-input component:

    <template>
      <vue-tel-input v-model="phone"></vue-tel-input>
    </template>

Installation

npm

  npm install vue-tel-input

Install the plugin into Vue:

import { createApp } from 'vue';
import App from './App.vue';
import VueTelInput from 'vue-tel-input';
import 'vue-tel-input/vue-tel-input.css';

const globalOptions = {
  mode: 'auto',
};

const app = createApp(App);
app.use(VueTelInput, globalOptions); // Define default global options here (optional)
app.mount('#app');

View all available options in Props.

Or use the component directly:

<template>
  <vue-tel-input v-model="phone" mode="international"></vue-tel-input>
</template>

<script>
  import { ref } from 'vue';
  import { VueTelInput } from 'vue-tel-input';
  import 'vue-tel-input/vue-tel-input.css';

  export default {
    components: {
      VueTelInput,
    },

    setup() {
      const phone = ref(null);

      return {
        value,
      };
    },
  };
</script>

Browser

<script src="https://unpkg.com/vue-tel-input"></script>
<link rel="stylesheet" href="https://unpkg.com/vue-tel-input/dist/vue-tel-input.css" />

If Vue is detected in the Page, the plugin is installed automatically.

** Otherwise, manually install the plugin into Vue:

app.use(window['vue-tel-input']);

Component lazy loading

Since the library is about 200kb of JavaScript and 100kb of CSS in order to improve initial page loading time you might consider importing it asynchronously only when user navigates to the page where the library is actually needed. The technique is called Lazy Load and you can use it in some modern bundlers like Webpack and Rollup.

<!-- your-component.vue-->
<template>
  <vue-tel-input v-model="value"></vue-tel-input>
</template>
<script>
  const VueTelInput = () =>
    Promise.all([
      import(/* webpackChunkName: "chunk-vue-tel-input" */ 'vue-tel-input'),
      import(/* webpackChunkName: "chunk-vue-tel-input" */ 'vue-tel-input/vue-tel-input.css'),
    ]).then(([{ VueTelInput }]) => VueTelInput);

  export default {
    components: {
      VueTelInput,
    },
  };
</script>

As you see, we don't use Vue SFC <style></style> tag here to import component's css as it would result in CSS going to the main/vendors bundle instead of being downloaded on demand.

Development

Clone the project

  git clone https://github.com/iamstevendao/vue-tel-input.git

Go to the project directory

  cd vue-tel-input

Install dependencies

  npm install

Start the server

  npm run dev

License

Copyright (c) 2018 Steven Dao. Released under the MIT License.

made with by Steven.

9.0.1

11 days ago

9.0.0

18 days ago

5.15.0

4 months ago

8.3.1

4 months ago

8.2.0

5 months ago

8.3.0

4 months ago

8.1.2

9 months ago

5.14.2

6 months ago

5.14.1

7 months ago

8.1.4

8 months ago

8.1.3

9 months ago

8.1.0

1 year ago

8.1.1

1 year ago

5.13.3

1 year ago

5.13.2

1 year ago

5.13.1

1 year ago

5.13.0

1 year ago

5.14.0

1 year ago

8.0.1

1 year ago

8.0.0

1 year ago

5.12.0

2 years ago

6.0.5

2 years ago

6.0.4

2 years ago

6.0.1

2 years ago

6.0.0

2 years ago

6.0.3

2 years ago

6.0.2

2 years ago

6.0.0-beta.7

2 years ago

5.11.0

2 years ago

6.0.0-beta.6

2 years ago

5.8.0

2 years ago

5.9.0

2 years ago

5.10.1

2 years ago

5.10.0

2 years ago

5.7.0

2 years ago

6.0.0-beta.5

2 years ago

5.6.3

2 years ago

6.0.0-beta.3

3 years ago

6.0.0-beta.4

3 years ago

5.6.2

3 years ago

6.0.0-beta.1

3 years ago

6.0.0-beta.2

3 years ago

5.6.1

3 years ago

5.6.0

3 years ago

5.5.0

3 years ago

5.4.0

3 years ago

6.0.0-beta.0

3 years ago

5.3.0

3 years ago

5.2.0

3 years ago

5.1.0

3 years ago

5.0.4

3 years ago

5.0.3

3 years ago

5.0.2

3 years ago

5.0.0-beta.6

3 years ago

5.0.0-beta.4

3 years ago

5.0.0-beta.5

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

5.0.0-beta.3

3 years ago

5.0.0-beta.2

3 years ago

5.0.0-beta.1

3 years ago

5.0.0-beta.0

3 years ago

4.4.2

3 years ago

4.4.1

4 years ago

4.4.0

4 years ago

4.3.0

4 years ago

4.2.0

4 years ago

4.1.1

4 years ago

4.1.0

4 years ago

4.0.0

5 years ago

3.3.0

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

3.1.8

5 years ago

3.1.7

5 years ago

3.1.6

5 years ago

3.1.5

5 years ago

3.1.4

5 years ago

3.1.3

5 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.5.0

5 years ago

2.5.3

5 years ago

2.4.3

5 years ago

2.4.2

5 years ago

2.4.1

5 years ago

2.4.0

5 years ago

2.3.0

5 years ago

2.2.6

5 years ago

2.2.5

5 years ago

2.2.4

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.22

5 years ago

2.0.21

5 years ago

2.0.20

5 years ago

2.0.19

5 years ago

2.0.18

5 years ago

2.0.17

5 years ago

2.0.16

5 years ago

2.0.15

5 years ago

2.0.14

5 years ago

2.0.13

5 years ago

2.0.12

5 years ago

2.0.11

5 years ago

2.0.10

5 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.3.9

6 years ago

1.3.8

6 years ago

1.3.7

6 years ago

1.3.6

6 years ago

1.3.5

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago