validator.js

【转】vue.js表单校验详解

自古美人都是妖i 提交于 2021-02-16 11:09:49
官方文档:https://monterail.github.io/vuelidate/ https://github.com/monterail/vuelidate 1.npm安装vue-validator $ npm install vue-validator 代码示例: var Vue=require("vue" ); var VueValidator=require("vue-validator" ); Vue.use(VueValidator); 2.直接使用script标签引入vue.js 要下载vue-validator,那么进入cdn的地址https://cdn.bootcss.com/vue-validator/2.1.3/vue-validator.js把内容复制下来就好了。版本使用了2.1.3,不要搞错了哦。 下面是简单的小例子。 <! DOCTYPE html > < html lang ="en" > < head > < meta charset ="UTF-8" > < title > Title </ title > </ head > < body > < div id ="app" > < validator name ="myForm" > < form novalidate > Zip: < input type ="text" v

Implicit async custom validators (custom validators that take 2 arguments) are deprecated in mongoose >= 4.9.0

无人久伴 提交于 2021-01-27 05:19:10
问题 I'm using mongoose 4.9.0. Whilst the code below works, I get a warning like the following: (node:24769) DeprecationWarning: Implicit async custom validators (custom validators that take 2 arguments) are deprecated in mongoose >= 4.9.0. See http://mongoosejs.com/docs/validation.html#async-custom-validators for more info. I suspect the error is coming from the model validators. const mongoose = require('mongoose'); const isEmail = require('validator/lib/isEmail'); const Schema = mongoose.Schema