An open API service indexing awesome lists of open source software.

https://github.com/chantouch/vue-vlidator

To integrate with client and server-side validation logical with VueJS.
https://github.com/chantouch/vue-vlidator

client-side laravel proxy ruby server-side validator vue-components vuejs

Last synced: about 1 year ago
JSON representation

To integrate with client and server-side validation logical with VueJS.

Awesome Lists containing this project

README

          

# Vue Vlidator

[![Latest Version on NPM](https://img.shields.io/npm/v/vue-vlidator.svg?style=flat-square)](https://npmjs.com/package/vue-vlidator)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![npm](https://img.shields.io/npm/dt/vue-vlidator.svg?style=flat-square)](https://npmjs.com/package/vue-vlidator)
[![npm](https://img.shields.io/npm/dm/vue-vlidator.svg?style=flat-square)](https://npmjs.com/package/vue-vlidator)

## Installation

### Using npm

```npm
npm install vue-vlidator
```

### Using yarn

```yarn
yarn add vue-vlidator
```

## Use with NuxtJS

Put it on top of `nuxt-i18n`

``nuxt.config.js``
```js
export default {
modules: [
'vue-vlidator/nuxt',
'nuxt-i18n',
],
vlidator: {}
}
```

### Vue plugins

```js
import Vue from 'vue';
import Validator from 'vue-vlidator';

const options = { locale: 'km', customAttributes: {}, customMessages: {} }

Vue.use(Validator, options);
```

#### Available options
1. locale {string}
2. customMessages {Object}
3. customAttributes {Object}

#### Example in Vue component
```vue












Submit

export default {
name: "HomePage",
data () {
return {
form: {
name: 'John',
email: 'johndoe@gmail.com',
age: 18
}
}
},
vlidator: {
rules: {
form: {
name: 'required|min:4',
email: 'required|email',
age: 'required|numeric|min:18|max:50'
}
}
},
methods: {
onSubmit () {
if (!this.validate()) return
alert(JSON.stringify(this.form))
}
},
}

```

---

### License

Copyright © 2020 Chantouch Sek

Released under the MIT license

### Credits

vue-vlidator re-write by Chantouch Sek

E-Mail: [chantouchsek.cs83@gmail.com](mailto:chantouchsek.cs93@gmail.com)

Twitter [@DevidCs83](https://twitter.com/DevidCs83)

Website: [chantouch.me](https://chantouch.me)