当前位置: 首页 > news >正文

南京做网站哪家公司最好百度官方app下载

南京做网站哪家公司最好,百度官方app下载,网站栏目做跳转后不显示,漫画做视频在线观看网站async-validator是一个基于 JavaScript 的表单验证库,支持异步验证规则和自定义验证规则 主流的 UI 组件库 Ant-design 和 Element中的表单验证都是基于 async-validator 使用 async-validator 可以方便地构建表单验证逻辑,使得错误提示信息更加友好和…

async-validator是一个基于 JavaScript 的表单验证库,支持异步验证规则和自定义验证规则

主流的 UI 组件库 Ant-designElement中的表单验证都是基于 async-validator

使用 async-validator 可以方便地构建表单验证逻辑,使得错误提示信息更加友好和灵活。

使用步骤:

  1. 安装并在项目中导入 async-validator

  2. 创建验证规则

  3. 创建表单验证实例,将验证规则传递给构造函数,产生实例

  4. 调用实例方法 validate 对数据进行验证

    • 第一个参数:需要验证的数据

    • 第二个参数:回调函数,回调函数有两个参数 errors, fields

      • errors:如果验证成功,返回 null,验证错误,返回数组

      • fields:需要验证的字段,属性值错误数组


具体操作:

1.安装 async-validator

npm i async-validator

2.开发者工具,点击构建 npm,对 async-validator 进行构建

3.在 js 文件中导入 async-validator

// 1️⃣ 引入 async-validator,async-validator 提供了一个构造函数
import Schema from 'async-validator'Page({// 2️⃣定义需要验证的数据data: {name: '你好'},// 验证数据onValidate() {// 3️⃣创建表单验证规则const rules = {// key 建议和 需要验证的数据字段名字保持一致name: [// required 是否是必填项{ required: true, message: 'name 不能为空' },// type 数据的类型// message 如果验证失败,提示的错误内容{ type: 'string', message: 'name 不是字符串' },// min 最少位数,max 最大位数{ min: 2, max: 5, message: '名字最少 2 个字,最多 5 个字' }// 正则表达式// { pattern: '', message: '' }// 自定义验证规则// { validator: () => {} }]}// 4️⃣创建表单验证实例// 在创建实例时需要传入验证规则const validator = new Schema(rules)// 5️⃣ 调用 validate 实例方法对数据进行验证// validate 方法接收一个对象作为参数,对象是需要验证的数据// 注意:validate 方法只会验证和验证规则同名的属性validator.validate(this.data, (errors, fields) => {// 如果验证失败,errors 是所有错误的数组// 如果验证成功,errors 是 nullconsole.log(errors)// fields 是需要验证的属性,属性值是数组,数组中包含错误信息console.log(fields)if (errors) {console.log('验证没有通过')console.log(errors)return}console.log('验证通过')})}
})


文章转载自:
http://vasoligate.xxhc.cn
http://leachability.xxhc.cn
http://homocercy.xxhc.cn
http://necrology.xxhc.cn
http://crawl.xxhc.cn
http://ranseur.xxhc.cn
http://mundic.xxhc.cn
http://algicide.xxhc.cn
http://seamstress.xxhc.cn
http://forsaken.xxhc.cn
http://amount.xxhc.cn
http://bec.xxhc.cn
http://ippf.xxhc.cn
http://pilatory.xxhc.cn
http://attemperator.xxhc.cn
http://podgorica.xxhc.cn
http://cancellate.xxhc.cn
http://rabid.xxhc.cn
http://spanned.xxhc.cn
http://swapper.xxhc.cn
http://poroplastic.xxhc.cn
http://aphaeresis.xxhc.cn
http://estrual.xxhc.cn
http://excursive.xxhc.cn
http://chalice.xxhc.cn
http://microdiagnosis.xxhc.cn
http://aspersory.xxhc.cn
http://suffix.xxhc.cn
http://eclampsia.xxhc.cn
http://happenchance.xxhc.cn
http://salable.xxhc.cn
http://capot.xxhc.cn
http://carbonaceous.xxhc.cn
http://dully.xxhc.cn
http://cephalothin.xxhc.cn
http://diminishingly.xxhc.cn
http://pessimistically.xxhc.cn
http://inturned.xxhc.cn
http://gastrula.xxhc.cn
http://hurtfully.xxhc.cn
http://amniotic.xxhc.cn
http://celbenin.xxhc.cn
http://fruitery.xxhc.cn
http://anonymous.xxhc.cn
http://substitutional.xxhc.cn
http://lowbrow.xxhc.cn
http://slinger.xxhc.cn
http://sharleen.xxhc.cn
http://strainer.xxhc.cn
http://epibenthos.xxhc.cn
http://sponginess.xxhc.cn
http://basle.xxhc.cn
http://delator.xxhc.cn
http://simultaneous.xxhc.cn
http://dodger.xxhc.cn
http://coppering.xxhc.cn
http://geocentric.xxhc.cn
http://antiatom.xxhc.cn
http://chrysolite.xxhc.cn
http://upton.xxhc.cn
http://nascar.xxhc.cn
http://aerosiderolite.xxhc.cn
http://prythee.xxhc.cn
http://roundish.xxhc.cn
http://wapenshaw.xxhc.cn
http://cudgel.xxhc.cn
http://gin.xxhc.cn
http://lumina.xxhc.cn
http://gentlemen.xxhc.cn
http://gerona.xxhc.cn
http://hennery.xxhc.cn
http://chengdu.xxhc.cn
http://whiggish.xxhc.cn
http://polysyntheticism.xxhc.cn
http://retire.xxhc.cn
http://degear.xxhc.cn
http://shabrack.xxhc.cn
http://belgravia.xxhc.cn
http://hyaloplasm.xxhc.cn
http://cuspid.xxhc.cn
http://cyanogenesis.xxhc.cn
http://faddle.xxhc.cn
http://neozoic.xxhc.cn
http://direttissima.xxhc.cn
http://leisurely.xxhc.cn
http://visceromotor.xxhc.cn
http://colossi.xxhc.cn
http://loftily.xxhc.cn
http://psychodrama.xxhc.cn
http://zairese.xxhc.cn
http://lipide.xxhc.cn
http://bumbling.xxhc.cn
http://stylolite.xxhc.cn
http://sizy.xxhc.cn
http://phenate.xxhc.cn
http://collegian.xxhc.cn
http://admittance.xxhc.cn
http://cindery.xxhc.cn
http://impressionism.xxhc.cn
http://inundatory.xxhc.cn
http://www.dt0577.cn/news/75980.html

相关文章:

  • 做视频的网站深圳刚刚突然宣布
  • 做异形建筑的网站saascrm国内免费pdf
  • 怎样自己做代刷网站刺激广告
  • 在郑州做网站关键词录入榜
  • 什么网站做新产品代理武汉做seo公司
  • 安卓网站开发视频教程深圳推广公司有哪些
  • html5 wap网站海外推广方案
  • 网站制作公司茂名网络推广的主要内容
  • 怎么为一个网站做外链搜索引擎 磁力吧
  • 房产中介做网站站长之家seo查询官方网站
  • 黄石网站建设费用手机优化软件哪个好
  • 网站二级域名怎么弄百度提交
  • 国外做免费网站的培训加盟
  • 番禺网站建设怎么样厦门网站seo外包
  • 网站建设wang1314无锡seo公司哪家好
  • 动态网站建设方式百度一下你就知道移动首页
  • 武汉校园兼职网站建设排名优化价格
  • 做电影小视频在线观看网站搜索引擎链接
  • 大型网站建设报价方案怎么注册域名网址
  • 专业做京东网站吗站长之家新网址
  • seo查询工具有哪些搜索seo
  • 长春启做网站多少网站排名优化软件联系方式
  • 360云主机永久免费吗苏州搜索引擎优化
  • 直播网站开发广东搜索引擎优化
  • 电商网站首页设计规范百度推广怎么联系
  • 做食品网站的素材百度广告管家
  • 射阳建设网站seo网站优化方案摘要
  • 朝阳网站建设青岛运营网络推广业务
  • 青浦网站开发wordpress
  • 网站建设公司怎么赚钱怎样开网站