vue-tel-input 6.0.5 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -46
- package/dist/vue-tel-input.js +3631 -0
- package/dist/vue-tel-input.umd.cjs +9 -0
- package/package.json +18 -29
- package/dist/css/component.css +0 -98
- package/dist/css/sprite.css +0 -1071
- package/dist/vue-tel-input.cjs.js +0 -9
- package/dist/vue-tel-input.es.js +0 -4205
- package/dist/vue-tel-input.iife.js +0 -11
- /package/dist/{vue-tel-input.css → style.css} +0 -0
package/README.md
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img width="100" alt="vue-tel-input-logo" src="https://vue-tel-input.iamstevendao.com/hero.png"/>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# vue-tel-input
|
|
2
6
|
|
|
3
7
|
International Telephone Input with Vue.
|
|
4
8
|
|
|
5
|
-
[](https://www.npmjs.com/package/vue-tel-input) [](https://github.com/iamstevendao/vue-tel-input)
|
|
9
|
+
[](https://www.npmjs.com/package/vue-tel-input) [](https://github.com/iamstevendao/vue-tel-input)
|
|
6
10
|
|
|
7
11
|
<p align="center">
|
|
8
|
-
<img width="
|
|
12
|
+
<img width="600" alt="In-action GIF" src="https://thumbs.gfycat.com/EducatedPoliteBluefintuna-size_restricted.gif"/>
|
|
9
13
|
</p>
|
|
10
14
|
|
|
11
|
-
## Documentation and
|
|
15
|
+
## Documentation and Demo
|
|
16
|
+
|
|
17
|
+
[Visit the website](https://vue-tel-input.iamstevendao.com/)
|
|
18
|
+
|
|
19
|
+
## Vue 2 Support
|
|
12
20
|
|
|
13
|
-
[
|
|
21
|
+
`vue-tel-input@legacy`: [Guide](https://vue-tel-input.iamstevendao.com/guide/legacy.html)
|
|
22
|
+
|
|
23
|
+
## Changelog
|
|
24
|
+
|
|
25
|
+
[Go to Github Releases](https://github.com/iamstevendao/vue-tel-input/releases)
|
|
14
26
|
|
|
15
27
|
## Getting started
|
|
16
28
|
|
|
@@ -23,11 +35,13 @@ International Telephone Input with Vue.
|
|
|
23
35
|
- Add the plugin into your app:
|
|
24
36
|
|
|
25
37
|
```javascript
|
|
26
|
-
import Vue from 'vue'
|
|
27
|
-
import VueTelInput from 'vue-tel-input'
|
|
28
|
-
import 'vue-tel-input/dist/vue-tel-input.css'
|
|
38
|
+
import Vue from 'vue';
|
|
39
|
+
import VueTelInput from 'vue-tel-input';
|
|
40
|
+
import 'vue-tel-input/dist/vue-tel-input.css';
|
|
29
41
|
|
|
30
|
-
|
|
42
|
+
const app = createApp(App);
|
|
43
|
+
app.use(VueTelInput);
|
|
44
|
+
app.mount('#app');
|
|
31
45
|
```
|
|
32
46
|
|
|
33
47
|
[More info on installation](#installation)
|
|
@@ -37,7 +51,7 @@ International Telephone Input with Vue.
|
|
|
37
51
|
```html
|
|
38
52
|
<template>
|
|
39
53
|
<vue-tel-input v-model="phone"></vue-tel-input>
|
|
40
|
-
|
|
54
|
+
</template>
|
|
41
55
|
```
|
|
42
56
|
|
|
43
57
|
## Installation
|
|
@@ -51,32 +65,47 @@ International Telephone Input with Vue.
|
|
|
51
65
|
Install the plugin into Vue:
|
|
52
66
|
|
|
53
67
|
```javascript
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import 'vue-tel-input
|
|
68
|
+
import { createApp } from 'vue';
|
|
69
|
+
import App from './App.vue';
|
|
70
|
+
import VueTelInput from 'vue-tel-input';
|
|
71
|
+
import 'vue-tel-input/dist/vue-tel-input.css';
|
|
57
72
|
|
|
58
|
-
|
|
73
|
+
const globalOptions = {
|
|
74
|
+
mode: 'auto',
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const app = createApp(App);
|
|
78
|
+
app.use(VueTelInput, globalOptions); // Define default global options here (optional)
|
|
79
|
+
app.mount('#app');
|
|
59
80
|
```
|
|
60
81
|
|
|
61
|
-
> View all available options in [Props](https://
|
|
82
|
+
> View all available options in [Props](https://vue-tel-input.iamstevendao.com/usage/props.html).
|
|
62
83
|
|
|
63
84
|
Or use the component directly:
|
|
64
85
|
|
|
65
86
|
```html
|
|
66
|
-
<!-- your-component.vue-->
|
|
67
87
|
<template>
|
|
68
|
-
<vue-tel-input v-model="
|
|
88
|
+
<vue-tel-input v-model="phone" mode="international"></vue-tel-input>
|
|
69
89
|
</template>
|
|
70
|
-
<script>
|
|
71
|
-
import { VueTelInput } from 'vue-tel-input'
|
|
72
90
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
91
|
+
<script>
|
|
92
|
+
import { ref } from 'vue';
|
|
93
|
+
import { VueTelInput } from 'vue-tel-input';
|
|
94
|
+
import 'vue-tel-input/dist/vue-tel-input.css';
|
|
95
|
+
|
|
96
|
+
export default {
|
|
97
|
+
components: {
|
|
98
|
+
VueTelInput,
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
setup() {
|
|
102
|
+
const phone = ref(null);
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
value,
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
};
|
|
80
109
|
</script>
|
|
81
110
|
```
|
|
82
111
|
|
|
@@ -84,20 +113,42 @@ export default {
|
|
|
84
113
|
|
|
85
114
|
```html
|
|
86
115
|
<script src="https://unpkg.com/vue-tel-input"></script>
|
|
87
|
-
<link rel="stylesheet" href="https://unpkg.com/vue-tel-input/dist/vue-tel-input.css"
|
|
116
|
+
<link rel="stylesheet" href="https://unpkg.com/vue-tel-input/dist/vue-tel-input.css" />
|
|
88
117
|
```
|
|
89
118
|
|
|
90
119
|
**If Vue is detected in the Page, the plugin is installed automatically.**
|
|
91
120
|
|
|
92
|
-
|
|
121
|
+
\*\* Otherwise, manually install the plugin into Vue:
|
|
93
122
|
|
|
94
123
|
```js
|
|
95
|
-
|
|
124
|
+
app.use(window['vue-tel-input']);
|
|
96
125
|
```
|
|
97
126
|
|
|
98
|
-
|
|
127
|
+
### Component lazy loading
|
|
99
128
|
|
|
100
|
-
|
|
129
|
+
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](https://webpack.js.org/guides/lazy-loading/) and you can use it in some modern bundlers like Webpack and Rollup.
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<!-- your-component.vue-->
|
|
133
|
+
<template>
|
|
134
|
+
<vue-tel-input v-model="value"></vue-tel-input>
|
|
135
|
+
</template>
|
|
136
|
+
<script>
|
|
137
|
+
const VueTelInput = () =>
|
|
138
|
+
Promise.all([
|
|
139
|
+
import(/* webpackChunkName: "chunk-vue-tel-input" */ 'vue-tel-input'),
|
|
140
|
+
import(/* webpackChunkName: "chunk-vue-tel-input" */ 'vue-tel-input/dist/vue-tel-input.css'),
|
|
141
|
+
]).then(([{ VueTelInput }]) => VueTelInput);
|
|
142
|
+
|
|
143
|
+
export default {
|
|
144
|
+
components: {
|
|
145
|
+
VueTelInput,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
</script>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
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.
|
|
101
152
|
|
|
102
153
|
## Development
|
|
103
154
|
|
|
@@ -107,11 +158,10 @@ Clone the project
|
|
|
107
158
|
git clone https://github.com/iamstevendao/vue-tel-input.git
|
|
108
159
|
```
|
|
109
160
|
|
|
110
|
-
Go to the project directory
|
|
161
|
+
Go to the project directory
|
|
111
162
|
|
|
112
163
|
```bash
|
|
113
164
|
cd vue-tel-input
|
|
114
|
-
git checkout next origin/next
|
|
115
165
|
```
|
|
116
166
|
|
|
117
167
|
Install dependencies
|
|
@@ -120,25 +170,12 @@ Install dependencies
|
|
|
120
170
|
npm install
|
|
121
171
|
```
|
|
122
172
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
npm run build
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Start the es build example
|
|
173
|
+
Start the server
|
|
130
174
|
|
|
131
175
|
```bash
|
|
132
176
|
npm run dev
|
|
133
177
|
```
|
|
134
178
|
|
|
135
|
-
Start the browser build example
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
npx http-server -p 8080
|
|
139
|
-
# 127.0.0.1:8080/examples/browser.html
|
|
140
|
-
```
|
|
141
|
-
|
|
142
179
|
## License
|
|
143
180
|
|
|
144
181
|
Copyright (c) 2018 Steven Dao.
|