vuejs-tips / vue-the-mask

Tiny (<2k gzipped) and dependency free mask input for Vue.js
https://vuejs-tips.github.io/vue-the-mask/
1.74k stars 213 forks source link

How to use that programmatically? #38

Open celorodovalho opened 7 years ago

celorodovalho commented 7 years ago

I have my component:

const vm = new Vue({
    el: '#FormVue',
    directives: {mask},
    validator: null,
    data() {
        return Object.assign({
            name: '',
            email: '',
            errors: null
        }, $_POST);
    }
});

How to use mask without directive? Example:

const vm = new Vue({
    el: '#FormVue',
    directives: {mask},
    validator: null,
    data() {
        return Object.assign({
            phone: {mask: '####-####'},
            cpf: {mask: '###.###.###-##'},
            errors: null
        }, $_POST);
    }
});
StanleyGulevich commented 5 years ago

It seems that the best way in your example is to use regular expressions.