A lightweight (2KB gzipped) and dependency free mask input created specific for Vue.js
yarn add vue-the-mask
or
npm i -S vue-the-mask
import VueTheMask from 'vue-the-mask'
Vue.use(VueTheMask)import {TheMask} from 'vue-the-mask'
export default {
  components: {TheMask}
}import {mask} from 'vue-the-mask'
export default {
  directives: {mask}
}'#': {pattern: /\d/},
'X': {pattern: /[0-9a-zA-Z]/},
'S': {pattern: /[a-zA-Z]/},
'A': {pattern: /[a-zA-Z]/, transform: v => v.toLocaleUpperCase()},
'a': {pattern: /[a-zA-Z]/, transform: v => v.toLocaleLowerCase()},
'!': {escape: true}| Property | Required | Type | Default | Description | 
|---|---|---|---|---|
| value | false | String | Input value or v-model | |
| mask | true | String, Array | Mask pattern | |
| masked | false | Boolean | false | emit value with mask chars, default is raw | 
| placeholder | false | String | Same as html input | |
| type | false | String | 'text' | Input type (email, tel, number, ...) | 
| tokens | false | Object | tokens | Custom tokens for mask | 
We understand that money format is a totally different domain, which needs another specific component. You can use https://github.com/vuejs-tips/v-money
- https://github.com/nosir/cleave.js 
- https://github.com/text-mask/text-mask 
- https://github.com/igorescobar/jQuery-Mask-Plugin 
- https://github.com/fernandofleury/vanilla-masker 
- https://github.com/angular-ui/ui-mask 
- https://github.com/insin/inputmask-core 
- https://github.com/niksmr/vue-masked-input 
- https://github.com/probil/v-mask 
- https://github.com/moip/awesome-mask 
- https://github.com/the-darc/string-mask 
- https://github.com/romulobrasil/PureMask.js 
- https://github.com/devindex/vue-mask 
- https://github.com/vuejs-tips/v-money 
- https://github.com/plentz/jquery-maskmoney 
- https://github.com/flaviosilveira/Jquery-Price-Format 
- https://github.com/kevinongko/vue-numeric 
You're free to contribute to this project by submitting issues and/or pull requests. This project is test-driven, so keep in mind that every change and new feature should be covered by tests. Your name will be added to the hall of fame ;)
This project is licensed under MIT License



