网站

http://vee-validate.logaretm.com/index.html#about

自定义为空时候的提示

Field-specific Custom Messages

You might need to provide different messages for different fields, for example you might want to display an error message for the email field when its required, but a different messsage when the name is required. This allows you to give your users a flexible experience and context aware messages.

To do this you would need to add an object to the dictionary called custom like this:

const dict = {
en: {
custom: {
email: {
required: 'Your email is empty' // messages can be strings as well.
},
name: {
required: () => 'Your name is empty'
}
}
}
};

Notice that the custom object contains properties that represent the field names, those field names objects contain properties that represent the validation rule that its value will be used instead of the default one.

Then you would need to add the dictionary we just constructed to the current validators dictionary like this:

Validator.updateDictionary(dict);
// or use the instance method
this.$validator.updateDictionary(dict);

veeValidate的更多相关文章

  1. Vue2.0表单校验组件vee-validate的使用

    vee-validate使用教程 *本文适合有一定Vue2.0基础的同学参考,根据项目的实际情况来使用,关于Vue的使用不做多余解释.本人也是一边学习一边使用,如果错误之处敬请批评指出* 一.安装 n ...

  2. 使用vee-validate表单插件是如何设置中文提示?

    最近在写vue表单验证的时候,在网上找到一款不错的插件vee-validate,在使用的过程中发现配置不了中文提示,这就很苦恼了,基本上网上的配置办法我都看过,都是有问题的,比如这种 import z ...

  3. Vue + iView + vuex + vee-validate 完整项目总结

    build/*.js config/*.js src/旧代码文件夹 部门最近的一个新项目启动,很幸运由我来主导整个前端部分的技术选型和整体架构,项目工作量很大,但是却没有足够的人手,只有三个连CSS都 ...

  4. vee-validate的使用

    官网地址:http://vee-validate.logaretm.com/ 这是一个插件Vue.js可以验证输入字段,显示错误,在一个简单而强大的方法.学习vee-validate,首先可以去阅读官 ...

  5. Vue.js + Nuxt.js 项目中使用 Vee-validate 表单校验

    vee-validate 是为 Vue.js 量身打造的表单校验框架,允许您校验输入的内容并显示对应的错误提示信息.它内置了很多常见的校验规则,可以组合使用多种校验规则,大部分场景只需要配置就能实现开 ...

  6. vee-validate表单验证组件

    vee-validate是VUE的基于模板的验证框架,允许您验证输入并显示错误 安装 npm i vee-validate --save 引入 import Vue from 'vue'; impor ...

  7. vee-validate校验demo

    //太长了,把异步校验放到前面吧: VeeValidate.Validator.extend('checkLoginName',{ getMessage:function () { return &q ...

  8. 直接引用vee-validate校验插件

    直接在页面引用vee-validate 源文件下载地址:http://www.bootcdn.cn/vee-validate/ 官方api https://baianat.github.io/vee- ...

  9. Vue 表单校验 vee-validate

    gitHub 地址:https://github.com/baianat/vee-validate 官网API 地址:https://baianat.github.io/vee-validate/ap ...

  10. VeeValidate配置中文的两种方法

    使用VeeValidate时遇到的问题,下面是我找到的一些解决办法: VeeValidate一直报错早不到addlocale方法 解决办法:1.卸载掉当前版本,重新安装低版本如2.0.0-rc.25  ...

随机推荐

  1. 使用Goland同步远程代码

    新版本的goland貌似已经有了Deployment功能,故本篇文章描述的方法也不推荐使用了 以前写php时候习惯使用phpstorm这个编译器,除去本身功能强大不说,比较方便的是其自身带的Deplo ...

  2. 快排(golang实现) 递归方法

    递归方法,逻辑简洁清晰.这个算法还是很重要的,需要重点记忆理解,面试经常考手写.据说是与傅里叶变换等并称“20世纪十大算法”.https://blog.csdn.net/v_JULY_v/articl ...

  3. [原创]利用python构造ICMP Echo Request并发送

    import socket import struct def checksum(source_string): sum = 0 countTo = (len(source_string)/2)*2 ...

  4. orm4sqlite

    //-------------------------------------------------------------------------- // // Copyright (c) BUS ...

  5. C++中的引用常见用法

    1.引用的内涵 引用就是给变量取外号而已. 2.四种不能使用引用的情况 void &r=x; //不能建立void类型引用 int &&r=x; //不能建立引用的引用 int ...

  6. leetcode-岛屿的个数

    岛屿的个数 给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量.一个岛被水包围,并且它是通过水平方向或垂直方向上相邻的陆地连接而成的.你可以假设网格的四个边均被水包围. 示例 ...

  7. leetcode-帕斯卡三角形

    帕斯卡三角形 给定一个非负整数 numRows,生成杨辉三角的前 numRows 行. 示例: 输入: 5 输出: [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4 ...

  8. 1053 Path of Equal Weight (30 分)(树的遍历)

    题目大意:给出树的结构和权值,找从根结点到叶子结点的路径上的权值相加之和等于给定目标数的路径,并且从大到小输出路径 #include<bits/stdc++.h> using namesp ...

  9. python常用函数—enumerate()

    enumerate() 对于一个可迭代的(iterable)/可遍历的对象(如列表.字符串),enumerate将其组成一个索引序列,利用它可以同时获得索引和值的元组. 使用拆包,可以单独获得索引和值 ...

  10. CryptoZombies学习笔记——Lesson5

    chapter1:token代币 简而言之,通证就是支持交易的包含一系列规范的函数接口的一个智能合约,发币可以用ERC20标准,但是像僵尸这种非同质化代币,需要用ERC721标准 chapter2:e ...