Skip to content

Commit 13b6c44

Browse files
committed
disallowed formatting a phone with the 'customValidate' property, remove unnecessary 'disabledFormatting' property
1 parent ebf8bae commit 13b6c44

File tree

5 files changed

+4
-8
lines changed

5 files changed

+4
-8
lines changed

README-v2.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ Read more on `vue-form-generator`'s [instruction page](https://icebob.gitbooks.i
103103
| `defaultCountry` | `String` | `''` | Default country, will override the country fetched from IP address of user |
104104
| `disabledFetchingCountry` | `Boolean` | `false` | Disable fetching current country based on IP address of user |
105105
| `disabled` | `Boolean` | `false` | Disable input field |
106-
| `disabledFormatting` | `Boolean` | `false` | Disable formatting the phone number in the input, the formatted result still be accessible by `formattedNumber` returned from `onInput` event |
107106
| `placeholder` | `String` | Enter a phone number | Placeholder for the input |
108107
| `required` | `Boolean` | `false` | Required property for HTML5 required attribute |
109108
| `enabledCountryCode` | `Boolean` | `false` | Enable country code in the input |

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ Read more on `vue-form-generator`'s [instruction page](https://icebob.gitbooks.i
163163
| `defaultCountry` | `String` | `''` | Default country, will override the country fetched from IP address of user |
164164
| `disabled` | `Boolean` | `false` | Disable input field |
165165
| `disabledFetchingCountry` | `Boolean` | `false` | Disable fetching current country based on IP address of user |
166-
| `disabledFormatting` | `Boolean` | `false` | Disable formatting the phone number in the input, the formatted result still be accessible by `formattedNumber` returned from `onInput` event |
167166
| `dropdownOptions` | `Object` | `{ disabledDialCode: false, tabindex: 0 }` | Options for dropdown, supporting `disabledDialCode` and `tabindex`|
168167
| `dynamicPlaceholder` | `Boolean` | `false` | Placeholder as a sample phone number in the current country, available from [v3.1.1](https://github.com/EducationLink/vue-tel-input/releases/tag/v3.1.1) |
169168
| `enabledCountryCode` | `Boolean` | `false` | Enable country code in the input |

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<div style="width: 500px; margin: 20px auto;">
1010
<vue-tel-input
1111
:preferred-countries="['us', 'gb', 'ua']"
12-
:valid-characters-only="true"
12+
:custom-validate="/^[0-9]*$/"
1313
@input="onInput"/>
1414
</div>
1515
<div

src/components/vue-tel-input.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,6 @@ export default {
133133
type: Boolean,
134134
default: () => getDefault('disabled'),
135135
},
136-
disabledFormatting: {
137-
type: Boolean,
138-
default: () => getDefault('disabledFormatting'),
139-
},
140136
mode: {
141137
type: String,
142138
default: () => getDefault('mode'),
@@ -252,6 +248,9 @@ export default {
252248
return this.placeholder;
253249
},
254250
parsedMode() {
251+
if (this.customValidate) {
252+
return 'input';
253+
}
255254
if (this.mode) {
256255
if (!['international', 'national'].includes(this.mode)) {
257256
console.error('Invalid value of prop "mode"');

src/utils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export const defaultOptions = {
3535
placeholder: 'Enter a phone number',
3636
disabledFetchingCountry: false,
3737
disabled: false,
38-
disabledFormatting: false,
3938
mode: '',
4039
invalidMsg: '',
4140
required: false,

0 commit comments

Comments
 (0)