0.0.9-beta-13 • Published 4 years ago

laravel-vue2-validator v0.0.9-beta-13

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

Laravel Vue Validator

By bookingkh.com

Latest Version on NPM Software License npm npm

This package allow to display errors from laravel validation rules

! This package needs axios or vue-resource to work !

Installation

npm install --save laravel-vue2-validator
import LaravelVueValidator from 'laravel-vue2-validator'
  
Vue.use(LaravelVueValidator)

Usage Example

If you have in your laravel validation rule :

'name' => 'required|min:2|max:20'

You can display the error using in vue :

<error input="name" />

This error will only be displayed if a 422 error is produced by laravel when the form is submited (when the rule is not satisfied)

To flush errors in a vue component:

this.$errors.flush()

Full Example

<template>
	<form @keydown="$errors.onKeydown($event)">
	    <input type='text' v-model='name' :inputClass="errorClass"/>
    	<error input="name" />
    	<button @click="submit">Submit</button>
</form>
</template>
<script>

export default {
	data(){
		return{
			name: '',
			errorClass: 'form-error'
		}
	},
	methods(){
		this.$http.post('/submit', {name: this.name});
	},
     destroyed () {
       this.$errors.flush()
     }
}

</script>
0.0.9-beta-13

4 years ago

0.0.9-beta-11

4 years ago

0.0.9-beta-10

4 years ago

0.0.9-beta-8

4 years ago

0.0.9-beta-7

4 years ago

0.0.9-beta-6

4 years ago

0.0.9-beta-5

4 years ago

0.0.9-beta-9

4 years ago

0.0.9-beta-0

4 years ago

0.0.9-beta-4

4 years ago

0.0.9-beta-3

4 years ago

0.0.9-beta-2

4 years ago

0.0.9-beta-1

4 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago