Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change mask #15

Open
dulingleb opened this issue Apr 30, 2019 · 3 comments
Open

Change mask #15

dulingleb opened this issue Apr 30, 2019 · 3 comments

Comments

@dulingleb
Copy link

dulingleb commented Apr 30, 2019

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

@DeBelserArne
Copy link

Hello there,

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

@bgriggs1
Copy link

bgriggs1 commented Jan 5, 2021

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

@DeBelserArne
Copy link

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

Thanks! I'll try that out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants