iview表单验证数字
验证输入字符串必须为数字
html:
<FormItem label="兑换积分:" prop="exchangeIntegral">
<Input v-model="formSpecAdd.exchangeIntegral" placeholder="请输入兑换积分" style="width: 250px"></Input>
</FormItem> <FormItem label="库存数量:" prop="stockNum">
<Input v-model="formSpecAdd.stockNum" placeholder="请输入库存数量" style="width: 250px"></Input>
</FormItem> <FormItem label="商品价值:" prop="productMoney">
<Input v-model="formSpecAdd.productMoney" placeholder="请输入商品价值" style="width: 250px"></Input>
</FormItem>
js:
exchangeIntegral: [
{required: true, message: '请输入兑换积分', trigger: 'blur'},
{type: 'string', pattern: /^\d+$/, message: '请输入数字', trigger: 'blur'}
], stockNum: [
{required: true, message: '请输入库存数量', trigger: 'blur'},
{type: 'string', pattern: /^\d+$/, message: '请输入数字', trigger: 'blur'}
], productMoney: [
{required: true, message: '请输入商品价值', trigger: 'blur'},
{type: 'string', pattern: /^\d+$/, message: '请输入数字', trigger: 'blur'}
],
或者: 直接将输入框定义为 number类型
<FormItem label="兑换积分:" prop="exchangeIntegral">
<Input v-model="formSpecAdd.exchangeIntegral" number placeholder="请输入兑换积分" style="width: 250px"></Input>
</FormItem>
js:验证
exchangeIntegral: [
{required: true, type: 'number', message: '请输入兑换积分', trigger: 'blur'},
{type: 'number', message: '请输入数字', trigger: 'blur'}
],
请参考:
https://www.cnblogs.com/chenmz1995/p/10804076.html
https://www.iviewui.com/components/form#ZDYYZ
https://github.com/yiminghe/async-validator
iview表单验证数字的更多相关文章
- iview表单验证--数字必填+校验
直接使用: { required: true, type:"integer", message:"请填写整数", trigger: "blur&quo ...
- iview表单验证下拉框不通过问题
iview表单验证的步骤: 第一步:给 Form 设置属性 rules :rules 第二步:同时给需要验证的每个 FormItem 设置属性 prop 指向对应字段即可 prop=”“ 第三步:注意 ...
- iview表单验证不生效问题注意点
按照iview官网介绍写的form表单验证,但是无论填写与否都不进行校验,找了很久的原因,突然才发现一个关键的地方,一定要加props!!! https://blog.csdn.net/xuaner8 ...
- iview表单验证之正则验证、函数验证
iview表单验证之正则 正则验证: 代码: loginRules: { stringLength: [ { required: true, message: '该字段不能为空', trigger: ...
- 有关使用 iview 表单验证的问题
Vue的UI解决框架,element-UI, iview-UI 有关表单验证使用的是同一个插件,async-validator,有关这个插件的用法就不做赘述,但是在iview表单的使用中可能会用到验证 ...
- iview 表单验证不通过问题?
项目需要,需要怂iview..使用一段时间感觉跟elementUI用起来差不多很方便.使用过程中遇到表单验证问题,如何避免在验证过程中偶尔出现验证不通过的异常情况? <1>:给 <F ...
- vue中使用iview表单验证时this指针问题
需求 使用iview,在提交时对值b进行验证,使其不能大于值a 实现 <Form ref="config" :model="config" :rules= ...
- iview 表单验证
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>& ...
- iview表单验证trigger:'change,blur'
今天发现,如果设置select的trigger:'blur'就算选择之后还是边框是红色的,之后查了一下iview的文档,也没有找到准确的蚊子描述,只看到form那个组件其中有一个例子,大概是selec ...
随机推荐
- idea 拉取git新分支
前面的话: 一不小心,删除了dev的分支,没办法.头头重新克隆了下,但是发现idea的右下角并没有啊,我记得之前遇到过一次 但还是忘记如何操作了,在这记录下,省的下次还得去百度 选中项目-git-fe ...
- linux设置脚本开机自启
由于在centos7中/etc/rc.d/rc.local的权限被降低了,所以需要赋予其可执行权 chmod +x /etc/rc.d/rc.local 赋予脚本可执行权限假设/opt/script/ ...
- BOM相关方法及属性
browser objec tmodel浏览器对象模型 BOM里面的方法大多在window对象底下,window代表窗口,也就是说,在BOM里面大多调用window下面的东西. 1.open方法是wi ...
- 使用.NET Framework开发IIS 7.0模块和处理程序拦截请求实现跳转
扩展IIS的两种方法:模块与处理程序. 模块,类似于以前的IIS版本中的ISAPI筛选器,它参与每个请求处理.IIS中一些现成的模块包括身份验证模块(用于处理请求的身份验证状态),压缩模块(用于压缩返 ...
- [服务器时区问题]PHP Warning: strftime(): It is not safe to rely on the system's timezone set
PHP Warning: strftime(): It is not safe to rely on the system's timezone set 当运行一些程序时,在httpd日志中会有如下警 ...
- mongodb download
https://www.mongodb.org/dl/win32/x86_64-2008plus-ssl
- Build Telemetry for Distributed Services之Open Telemetry来历
官网:https://opentelemetry.io/ github:https://github.com/open-telemetry/ Effective observability requi ...
- jmeter 调用python的方法三种 (还没试)
参考文章1: Jmeter 运行 Python 代码进行 AK/SK 认证 (使用 OS Process Sampler) 思路是:jmeter调用shell,用shell执行py 参考文章2: Jm ...
- Spring 控制器重定向
1.示例 return "redirect:/allUser"; redirect是跳转的意思后面是跳转的页面
- Django模板渲染之自定义inclusion_tag详细使用
inclusion_tag在使用的时候可以帮我们减少很多前端和后端重复的代码 逻辑图: inclusion_tag的作用是主页面以一定的语法给一个参数,调用某个函数,这个函数可以通过主页面给的参数做一 ...