Code Monkey home page Code Monkey logo

verify's Introduction

verify npm npm

统一的表单验证方式实现

Install

$ npm install --save form-verify

Usage

var verify = require('form-verify');

//verify.js不干预dom和样式,不提供默认提示,只做纯校验过程。
//注:不兼容ie7

//使用方式:
var v = verify({
		type:'single',//multi
		trim:false,//可选
		data:vue//可选 vue/angular等
	},
	[
	{
		value:val,
		el:'dom',
		model:'model',
		isEmpty:'用户名不能为空',
		minLength:'密码长度不小于6位&6',
		maxLength:'密码长度最大12位&12',
		length:'密码长度在6-12位&6-12',
		isMobile:'手机号不正确',
		custom:['&==2','错误-不等于2']
	}
	]);
	
//返回:
'single' //返回验证结果及单条错误信息。
'multi' //返回验证结果及多条错误信息,并设置dom。
'data:vue/angular' //返回验证结果及错误信息,并设置model。

Update

2018.2.9(Update)

  • 使用new重构verify.js
  • 修复ie8下的trim、filter等报错

2018.1.30(publish)

  • 发布至github及npm(form-verify)
  • 支持单条和多条错误提示,并设置dom
  • 支持vue/angular等配合使用

verify's People

Contributors

weijhfly avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.