vue-inputmask icon indicating copy to clipboard operation
vue-inputmask copied to clipboard

Change mask

Open dulingleb opened this issue 5 years ago β€’ 3 comments

<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?

dulingleb avatar Apr 30 '19 13:04 dulingleb

Hello there,

I have the same problem that the v-mask directive is not reactive. Have you found a solution?

DeBelserArne avatar Dec 17 '20 10:12 DeBelserArne

@aFluxx I added a key attribute based on the mask so it forces a re-render

bgriggs1 avatar Jan 05 '21 17:01 bgriggs1

@aFluxx I added a key attribute based on the mask so it forces a re-render

Thanks! I'll try that out

DeBelserArne avatar Apr 05 '21 19:04 DeBelserArne