vue-convenia-util
Plugin com validações, formatações e filtros para projetos Vue.
9,713
| Install | |
|---|---|
npm install vue-convenia-util |
|
| Latest Version: | 1.0.0 |
| Vue: | 2 |
| License: | MIT |
| Last Updated: | May 21, 2019 |
| Links: | npm |
Maintainer: vitorluizc
Vue Convenia Util
Plugin com validações, formatações e filtros para projetos Vue. Validação e formatação de CPF, CNPJ, datas, dinheiro (R$) etc.
Instalação
Instale a dependência publicada no NPM.
yarn add vue-convenia-util
Instalação global
Adiciona todas as funcionalidades descritas no objeto de configuração ao protótipo do Vue e consequentemente aos componentes.
import Vue from 'vue'
import Util from 'vue-convenia-util'
Vue.use(Util, {
formatters: true,
formatFilters: true
})
new Vue({
...
<template>
<strong>CPF: {{ user.document | toCPF }}</strong>
<strong>{{ cash }}</strong>
</template>
<script>
export default {
data: () => ({ user: { ... } })
computed: {
cash() {
return this.$format.toMoney(this.user.cash)
}
}
Integração com o vee-validate
O Util disponibiliza a função integrate que serve basicamente para o integrar
em outras libs. Com o vee-validade, e por enquanto só com ele mesmo, basta usar
essa função.
import Util from 'vue-convenia-util'
import VeeValidate, { Validator } from 'vee-validate'
// Util.integrate(nome da lib, objeto de integração, opções opcionais)
Util.integrate('vee-validate', Validator, {
isEmail: { // Por padrão apenas o isEmail é a única função que não é
name: 'email', // injetada no Validator e essa é a forma de faze-lo.
getMessage: () => 'Email inválido.'
}
})
Related Packages
vue-convenia-validator
A model-based form validation library for vue inspired by vuelidate and vee-vali...
3,001
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.0 | ^2.5.9 | MIT | |
| 0.7.1 | ^2.5.9 | MIT | |
| 0.7.0 | ^2.5.9 | MIT | |
| 0.6.1 | ^2.5.9 | MIT | |
| 0.6.0 | ^2.4.4 | MIT | |
| 0.5.3 | ^2.4.4 | MIT | |
| 0.5.2 | ^2.4.4 | MIT | |
| 0.4.1 | ^2.4.2 | MIT | |
| 0.4.0 | ^2.4.2 | MIT | |
| 0.3.0 | ^2.4.2 | MIT | |
| 0.2.1 | ^2.4.2 | MIT | |
| 0.2.0 | ^2.4.2 | MIT | |
| 0.1.0 | ^2.4.2 | MIT |