Skip to main content
VueVuetify

Vue 2 (and Vuetify): Allow only numeric characters for phone

By January 17, 2023No Comments

I used watch for this but there’s one small little tricky part.


1
2
3
4
5
6
7
8
9
phone: function (val) {

            let self = this;

            self.$nextTick(function () {
                self.phone = val.replace(/[^\d.-]+/g, '');
            });

        },

That is, we need to put a $nextTick to make this work.