Skip to content

vlacko0930/vuetify-input-mask

 
 

Repository files navigation

vuetify-input-mask

Yet another Vuetify component for input masking. Based on vue-input-mask.

Install

npm i -S vuetify-input-mask

Properties

mask : string

Mask string. Default format characters are:
9: 0-9
a: A-Z, a-z
*: A-Z, a-z, 0-9

Any character can be escaped with a backslash. It will appear as a double backslash in JS strings. For example, a German phone mask with unremoveable prefix +49 will look like mask="+4\9 99 999 99" or mask={'+4\\9 99 999 99'}

maskChar : string

Character to cover unfilled parts of the mask. Default character is "_". If set to null or empty string, unfilled parts will be empty as in ordinary input.

formatChars : object

Defines format characters with characters as a keys and corresponding RegExp strings as a values. Default ones:

{
  '9': '[0-9]',
  'a': '[A-Za-z]',
  '*': '[A-Za-z0-9]'
}

alwaysShowMask : boolean

Show mask when input is empty and has no focus.

Example

import Vue from 'vue';
import InputMask from 'vuetify-input-mask';

Vue.component('v-input-mask', InputMask)

In template:

    <v-input-mask v-model="value" mask="+4\9 99 999 99" maskChar=" "></v-input-mask>

Todo

  • Refactoring
  • Tests
  • Implementation of componentWillReceiveProps

Thanks

Thanks @sanniassin for the awesome component

About

Yet another Vue component for input masking

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vue 87.8%
  • JavaScript 8.4%
  • Shell 2.4%
  • HTML 1.4%