diff --git a/README.md b/README.md index e39f3bcc..49b76451 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,8 @@ Read more on `vue-form-generator`'s [instruction page](https://icebob.gitbooks.i | `dropdownOptions` | `Object` | `{ disabledDialCode: false, tabindex: 0 }` | Options for dropdown, supporting `disabledDialCode` and `tabindex`| | `inputOptions` | `Object` | `{ showDialCode: false, tabindex: 0 }` | Options for input, supporting `showDialCode` (always show dial code in the input) and `tabindex`| | `validCharactersOnly` | `Boolean` | `false` | Only allow valid characters in a phone number (will also verify in `mounted`, so phone number with invalid characters will be shown as an empty string) | - | `mode` | `String` | `''` | Format number to `'International'` (with + dial code) or `'National'` (with 0...) | + | `mode` | `String` | `''` | Format number to `'International'` (with + dial code) or `'National'` (with 0...), available from [v3.1.0](https://github.com/EducationLink/vue-tel-input/releases/tag/v3.1.0) | + | `dynamicPlaceholder` | `Boolean` | `false` | Placeholder as a sample phone number in the current country, available from [v3.1.0](https://github.com/EducationLink/vue-tel-input/releases/tag/v3.1.0) | ### Events @@ -128,7 +129,7 @@ Read more on `vue-form-generator`'s [instruction page](https://icebob.gitbooks.i | `enter` | | Fires on keyup.enter event | `onEnter` deprecated | | `open` | | Fires when the flags dropdown opens | | | `close` | | Fires when the flags dropdown closes | | - | `country-changed` | `Object` | Fires when country changed (even for the first time) | Available from `v2.4.2` | + | `country-changed` | `Object` | Fires when country changed (even for the first time) | Available from [v2.4.2](https://github.com/EducationLink/vue-tel-input/releases/tag/v2.4.2) | ### Slots | Slot | Description | Notes | diff --git a/src/components/vue-tel-input.vue b/src/components/vue-tel-input.vue index b99eb79e..e8214d50 100644 --- a/src/components/vue-tel-input.vue +++ b/src/components/vue-tel-input.vue @@ -36,7 +36,7 @@ { - if (!this.phone + this.initializeCountry() + .then(() => { + if (!this.phone && this.inputOptions && this.inputOptions.showDialCode - && this.activeCountry) { - this.phone = `+${this.activeCountry.dialCode}`; - } - this.$emit('validate', this.phoneObject); - this.$emit('onValidate', this.phoneObject); // Deprecated - }).catch(console.error); // eslint-disable-line + && this.activeCountry.dialCode) { + this.phone = `+${this.activeCountry.dialCode}`; + } + this.$emit('validate', this.phoneObject); + this.$emit('onValidate', this.phoneObject); // Deprecated + }) + .catch(console.error) + .finally(() => { + this.finishMounted = true; + }); }, created() { if (this.value) {