1.0.0-beta.2 • Published 3 years ago

simple-vue3-validator v1.0.0-beta.2

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

Simple Vue 3 Validator

Simple Vue 3 validator is a lightweight yet flexible plugin for Vue.js 3.0 that allows you to validate input fields, and display errors. It watches changes of your model data, validates them, and informs you with the validation result.

It supports the following features:

  • Fully customized validation rules.
  • Cross field validation.
  • Async/ajax validation (with supports of loading indicator, result caching, debounced user input).
  • Validating custom component.
  • Dynamic form / multiple validation instances.

Documentation

COMING SOON ⌚

Installation

Package is installable via npm.

npm install --save simple-vue3-validator

You can also install it via bower.

bower install --save simple-vue3-validator

NOTE

  • Bower installation is untested as of 2021/05/30
  • For bower package, please use /dist/plugin.js

Configuration

import { createApp } from 'vue'
import App from './App.vue'
import SimpleVueValidator from 'simple-vue3-validator'

const app = createApp(App)
  .use(SimpleVueValidator)

Basic Usage

Define the validators object in your vue / component instance:

validators: {
      email (value) {
        return Validator.value(value).required().email();
      }
    }

In the template HTML use the validation object injected by the library to display validation status / results.

<div class="message">{{ validation.firstError('email') }}</div>

NOTE

Full documentation coming soon ⌚

license MIT