2.0.3 • Published 4 years ago

@devindex/vue-mask v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Vue mask

Input mask lib for Vue.js based on String-Mask

Installation

This version only works in Vue 3.

# npm
$ npm i -S @devindex/vue-mask

# yarn
$ yarn add @devindex/vue-mask

Usage

import { createApp } from 'vue';
import VueMask from '@devindex/vue-mask'; // <-- ADD THIS LINE
import App from './App.vue';

const app = createApp(App);

app.use(VueMask);  // <-- ADD THIS LINE

app.mount('#app');

Basic usage on HTML input element

<input type="text" name="mask" v-model="mask" v-mask="'0000-0000'">

Available masks

v-mask

<input type="text" name="mask" v-model="mask" v-mask="'0000-0000'">

v-mask-date (us|br)

<input type="text" name="date" v-model="maskDate" v-mask-date.br>

v-mask-phone (us|br)

<input type="text" name="phone" v-model="maskPhone" v-mask-phone.br>

v-mask-decimal (us|br)

<input type="text" name="decimal" v-model="maskDecimal" v-mask-decimal.br="2">

v-mask-number

<input type="text" name="number" v-model="maskNumber" v-mask-number>

v-mask-cpf

<input type="text" name="cpf" v-model="maskCpf" v-mask-cpf>

v-mask-cnpj

<input type="text" name="cnpj" v-model="maskCnpj" v-mask-cnpj>

v-mask-cep

<input type="text" name="cep" v-model="maskCep" v-mask-cep>

v-mask-cc

<input type="text" name="cc" v-model="maskCc" v-mask-cc>

Special mask characters

CharacterDescription
0Any numbers
9Any numbers (Optional)
#Any numbers (Recursive)
AAny alphanumeric character
SAny letter
UAny letter (All lower case character will be mapped to uppercase)
LAny letter (All upper case character will be mapped to lowercase)
$Escape character, used to escape any of the special formatting characters.
2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago