Skip to content

Commit a9bbed3

Browse files
committed
[v3] Replace poi to vue cli build tool
1 parent ff96531 commit a9bbed3

File tree

13 files changed

+12631
-6990
lines changed

13 files changed

+12631
-6990
lines changed

.eslintrc.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
module.exports = {
44
root: true,
55
env: {
6-
browser: true,
6+
"node": true
77
},
88
extends: [
9-
'airbnb-base',
10-
'plugin:vue/recommended',
9+
"plugin:vue/essential",
10+
"@vue/airbnb"
1111
],
1212
plugins: ['vue'],
1313
parserOptions: {
1414
parser: 'babel-eslint',
15-
sourceType: 'module',
1615
},
1716
// add your custom rules here
1817
rules: {
@@ -21,7 +20,6 @@ module.exports = {
2120
'no-param-reassign': ['error', {
2221
props: true,
2322
ignorePropertyModificationsFor: [
24-
'state', // for vuex state
2523
'el',
2624
]
2725
}],

.lintstagedrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"*.{js,vue}": [
3+
"eslint --quiet --fix",
4+
"git add"
5+
]
6+
}

README.md

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -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

babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/app',
4+
],
5+
};

jest.config.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module.exports = {
2+
"moduleFileExtensions": [
3+
"js",
4+
"jsx",
5+
"json",
6+
"vue"
7+
],
8+
"transform": {
9+
"^.+\\.vue$": "vue-jest",
10+
".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$": "jest-transform-stub",
11+
"^.+\\.jsx?$": "babel-jest"
12+
},
13+
"transformIgnorePatterns": [
14+
"/node_modules/"
15+
],
16+
"moduleNameMapper": {
17+
"^@/(.*)$": "<rootDir>/src/$1"
18+
},
19+
"snapshotSerializers": [
20+
"jest-serializer-vue"
21+
],
22+
"testMatch": [
23+
"**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"
24+
],
25+
"testURL": "http://localhost/",
26+
"watchPlugins": [
27+
"jest-watch-typeahead/filename",
28+
"jest-watch-typeahead/testname"
29+
]
30+
}

0 commit comments

Comments
 (0)