1.1.5 • Published 7 years ago
vue-input-validator v1.1.5
vue-input-validator
Validate inputs using vue
Setup
import Vue from 'vue';
import VueInputValidator from 'vue-input-validator';
// import Promise from 'your-promise-lib';
Vue.use( VueInputValidator, { Promise } );
Basic Usage
Simple
<form @submit.prevent="submit">
<input v-validate="'required'" name="name" />
<div v-if="$errors.name">
Invalid input
</div>
</form>
export default {
// Creates a new scope for the validator
validate: true;
// ....
methods: {
submit() {
this.$validator.validate()
.then(() => {
// ... Do your thing
}, () => {
// Validation error
})
;
}
}
};
Rules
Register a new validation rule
/*
If the rule returns false or throw, it is an error
If the rule returns true | null | undefined. It is kept
If the rule return anything else, it is kept on the chain and the
next rule will be called with that value
*/
// Register a number rule
VueInputValidator.registerRule( 'number', function( v ) {
return parseInt(v, 10) == v;
});
1.1.5
7 years ago
1.1.4
7 years ago
1.1.3
7 years ago
1.1.2
7 years ago
1.1.1
7 years ago
1.1.0
7 years ago
1.0.9
7 years ago
1.0.8
7 years ago
1.0.7
7 years ago
1.0.6
7 years ago
1.0.5
7 years ago
1.0.4
7 years ago
1.0.2
7 years ago
1.0.0
7 years ago
0.3.4
7 years ago
0.3.3
7 years ago
0.3.2
7 years ago
0.3.1
7 years ago
0.3.0
7 years ago
0.2.5
7 years ago
0.2.4
7 years ago
0.2.3
7 years ago
0.2.2
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago