How to use mask in vuetify text-field?

后端 未结 2 1205
攒了一身酷
攒了一身酷 2021-01-04 00:51

I\'m trying to use the mask property of text-field component, like the example below. In the view, that works like a charm, but, when the form is posted, the mask format doe

2条回答
  •  执笔经年
    2021-01-04 01:37

    With Vuetify 2 they removed the mask attribute. However, there is a third-party solution. You can use the lightweight package v-mask by probil:

    Install the v-mask package (unpacked size 71.7 kB)

    npm install v-mask
    

    In your main.js import the package and add it as a directive:

    import { VueMaskDirective } from 'v-mask'
    Vue.directive('mask', VueMaskDirective);
    

    Then in your component add the mask using v-mask:

    
    

提交回复
热议问题