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.