vue-tel-input icon indicating copy to clipboard operation
vue-tel-input copied to clipboard

Copy paste breaks the validator.

Open wushan opened this issue 4 years ago • 2 comments

If you restrict the national code to a specific country like Thailand ( +66 ), there will be only one option ( +66 ) in the dropdown menu.

but if you copy paste a full phone number with another national code like 886930111111 in the input, although the dropdown options still one (+66 ), the input value will be +886 in the national code. and its valid number.

I think this is a bug, which we should add one more test on the 'change' event to make sure if the pasted national code is fit to the config.

wushan avatar Dec 01 '19 04:12 wushan

Also, pasting intl phone number while mode is set to national correctly parses phone but does NOT select required country from the dropdown, leaving the resulting phone number broken.

bkarlson avatar Apr 06 '20 16:04 bkarlson

I had this issue also, I resolved it by putting a ref on the input, and then calling onInput() on this.$nextTick() which correctly triggered all of the input logic and validation.

this.$nextTick(function() {
  this.$refs.phoneInput.onInput()
})

There's probably a simple PR to make here that would watch the input value and fire this method more reliably on an paste/autofill event.

brockdusome avatar May 19 '20 12:05 brockdusome