
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
npm i -S livr
npm i -S vue-livr
In your script entry point:
import Vue from 'vue';
import VueLIVR from 'vue-livr';
Vue.use(VueLIVR, {
extraRules: {}, // Extra rules to be added
extendedErrors: false, // Patch rules to return extended error codes
errorHandlers: {}, // Error handler to each error code that LIVR returns, it will run only if extendedErrors = true
aliasedRules: [], // list of aliasedRules to register
});
Now you are all set to use the plugin.
<input :class="{ invalid: errors.hasError('name')}" @blur="validate('name')" v-model="name" />
<span>errors.getError('name')</span>
import VueLIVR from 'vue-livr'
const livrRules = {
name: ['required', { max_length: 20 }],
};
export default {
data() {
return {
name: '',
};
},
mixins: [VueLIVR.mixin], // this will add a singleton this.$livr instance to your component
methods: {
validate(field) {
const { name } = this;
this.$livr.validate(livrRules, { name }, field);
},
},
};
<div v-for="(user, index) in users" :key="index">
<input
class="listing-units__input"
v-model="user.name"
@blur="validate('name', index)"
:class="{ invalid: errors.hasError('name', index) }"
/>
<span>{{errors.getError('name', index)}}</span>
</div>
<button @click="validateAll">Validate All</button>
const livrRules = {
users: [
'required',
{
list_of_objects: [
{
name: ['required', { min_length: 1 }],
},
],
},
],
};
export default {
data() {
return {
users: [{ name: '' }, { name: '' }],
};
},
methods: {
validate(field, index) {
const fieldName = `users[${index}].${field}[0]`;
this.$livr.validate(livrRules, this.users, fieldName);
},
validateAll() {
this.$livr.validateAll(livrRules, this.users);
},
},
};
MIT
FAQs
Vue LIVR plugin
The npm package vue-livr receives a total of 42 weekly downloads. As such, vue-livr popularity was classified as not popular.
We found that vue-livr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 50 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.