@@ -16,29 +16,27 @@ Checkout [Demo](https://educationlink.github.io/vue-tel-input/) or [Playground](
1616 ```
1717- ** npm** :
1818 ``` bash
19- npm i --save vue-tel-input
19+ npm install vue-tel-input
2020 ```
2121
2222## Usage
23- - Import default ` CSS ` to your project :
23+ - Install the component :
2424 ``` js
25- import ' vue-tel-input/dist/vue-tel-input.css' ;
25+ import Vue from ' vue'
26+ import VueTelInput from ' vue-tel-input'
27+
28+ Vue .use (VueTelInput)
2629 ```
2730
2831- In your component:
2932 ` ` ` html
3033 <template>
31- ...
32- <vue-tel-input v-model="phone"></vue-tel-input>
33- ...
34+ ...
35+ <vue-tel-input v-model="phone"></vue-tel-input>
36+ ...
3437 <template>
3538 <script>
36- import VueTelInput from 'vue-tel-input';
37-
3839 export default {
39- components: {
40- VueTelInput,
41- },
4240 data() {
4341 return {
4442 phone: '',
@@ -50,33 +48,27 @@ Checkout [Demo](https://educationlink.github.io/vue-tel-input/) or [Playground](
5048
5149### Use as a custom field of [vue- form- generator](https: // github.com/vue-generators/vue-form-generator)
5250- Add a component using ` vue-form-generator` ' s `abstractField` mixin
53- ```js
54- // tel-input.vue
55- <template>
56- <vue-tel-input v-model="value"></vue-tel-input>
57- </template>
58-
59- <script>
60- import VueTelInput from ' vue- tel- input'
61- import { abstractField } from ' vue- form- generator' ;
62-
63- export default {
64- name: ' TelephoneInput' ,
65- mixins: [abstractField],
66- components: {
67- VueTelInput,
68- },
69- };
70- </script>
51+ ```html
52+ <!-- tel-input.vue -->
53+ <template>
54+ <vue-tel-input v-model="value"></vue-tel-input>
55+ </template>
56+
57+ <script>
58+ import { abstractField } from ' vue- form- generator' ;
59+
60+ export default {
61+ name: ' TelephoneInput' ,
62+ mixins: [abstractField],
63+ };
64+ </script>
7165 ```
7266
7367- Register the new field as a global component
7468 ```js
7569 import Vue from ' vue' ;
7670 import TelInput from ' < path> / tel- input .vue ' ;
7771
78- import ' vue- tel- input/ dist/ vue- tel- input .css ' ;
79-
8072 Vue.component(' field- tel- input' , TelInput);
8173 ```
8274
0 commit comments