vue-inputmask
vue-inputmask copied to clipboard
Change mask
<input type="text" class="form-control" id="phone" name="phone" v-mask="phone.mask" :placeholder="phone.placeholder" required>
setPhoneCode: function (country) {
switch (country) {
case 'rus':
this.phone.flag = 'π·πΊ ';
this.phone.code = '+7';
this.phone.placeholder = '(___) ___-__-__';
this.phone.mask = '(999) 999-99-99';
break;
case 'kzt':
this.phone.flag = 'π°πΏ ';
this.phone.code = '+7';
this.phone.placeholder = '(___) ___-__-__';
this.phone.mask = '(999) 999-99-99';
break;
case 'uk':
this.phone.flag = 'πΊπ¦ ';
this.phone.code = '+380';
this.phone.placeholder = '(__) ___-__-__';
this.phone.mask = '(99) 999-99-99';
break;
case 'by':
this.phone.flag = 'π§πΎ ';
this.phone.code = '+375';
this.phone.placeholder = '(__) ___-__-__';
this.phone.mask = '(99) 999-99-99';
break;
}
}
Don't work v-mask="phone.mask" when i change country What i can do?
Hello there,
I have the same problem that the v-mask directive is not reactive. Have you found a solution?
@aFluxx I added a key attribute based on the mask so it forces a re-render
@aFluxx I added a key attribute based on the mask so it forces a re-render
Thanks! I'll try that out