HTML

<el-form ref='from' :model="fromData">
<el-table ref="tableman"
border
v-loading='loading'
empty-text="没有相关数据"
max-height="400"
size="mini"
:data="fromData.domains"
align="left"
highlight-current-row
@selection-change="MaterilsChange"
:showOverflowTooltip="true"
style="min-width: 100%;min-height:100px;">
<el-table-column type="selection"
align="center"
width="55">
</el-table-column>
<el-table-column v-for="(item,index) in Materilscolumn"
:key="index"
:label="item.label"
align="center"
:prop="item.prop"
:min-width="item.minWidth">
</el-table-column>
<!--输入数量栏-->
<el-table-column label="数量"
align="center"
:min-width="90">
<template slot-scope="scope">
<el-form-item :prop="'domains.'+scope.$index+'.num'" :rules="fromaDataRules.num">
<el-input v-model="scope.row.num" @change='inputchange(scope.row,scope.$index)'></el-input>
</el-form-item>
</template>
 
</el-table-column>
</el-table>
<!-- 底部操作栏 -->
</el-form>
 
 
 
script
<script>
export default {
data() {
return {
dialogFormVisible:false,
fromData:{
domains:undefined
},
fromaDataRules:{
name:[{ required: true, message: '请输入活动名称', trigger: 'blur' },{validator:(rule, value, callback) =>{
let reg = /^[0-9]*$/
console.log(value)
if(!reg.test(value)){
callback(new Error('数量应为数字'));
}else if(value==0){
callback(new Error('数量应大于0'));
}else{
callback()
}
},trigger: 'blur'},],
desc:[ { required: true, message: '请填写活动形式', trigger: 'blur' }]
},
domains:[],
}
},
mounted(){
this.initDomains()
},
methods:{
initDomains(){
this.domains=[
{
name: undefined,
desc: undefined
},
{
name:undefined,
desc:undefined
}
]
},
init(){
this.dialogFormVisible = true
this.$set(this.fromData,'domains',this.domains)
},
submit(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!');
} else {
console.log('error submit!!');
return false;
}
});
}
}
}
</script>
 
https://blog.csdn.net/xiaojun081004/article/details/82988549
 

table 里输入rules 验证的更多相关文章

  1. element-ui 解决 table 里包含表单验证的问题!

    实际项目中的场景,需要在table里做表单的验证,如图效果: 其实问题关键就在于如何给el-form-item动态绑定prop :prop="'tableData.' + scope.$in ...

  2. Yii CModel中rules验证规则[转]

    array( array(‘username’, ‘required’), array(‘username’, ‘length’, ‘min’=>3, ‘max’=>12), array( ...

  3. Yii2 rules验证规则

    Rules验证规则:  required : 必须值验证属性||CRequiredValidator 的别名, 确保了特性不为空. [['字段名1','字段名2'],required]    //字段 ...

  4. Yii CModel中rules验证规则

    array( array(‘username’, ‘required’), array(‘username’, ‘length’, ‘min’=>3, ‘max’=>12), array( ...

  5. Java工作流引擎表单引擎之JS表单字段输入脚本验证

    关键字: 表单设计器, 字段验证. workflow,ccform, ccBPM. 工作流快速开发平台  工作流流设计  业务流程管理   asp.net 开源工作流bpm工作流系统  java工作流 ...

  6. 使用C#或javascript将Table里的数据导出到Excel

    原文:使用C#或javascript将Table里的数据导出到Excel Demo效果图: 用C#将Table数据导出Excel: 本方法已经将导出excel做成分部视图,引用时只需在视图中使用如下代 ...

  7. 阿里云提示WordPress“/wp-includes/http.php输入IP验证不当”的解决办法

    本文转自:https://www.liuzhishi.com/2931.html 标题: wordpress IP验证不当漏洞 简介: wordpress /wp-includes/http.php文 ...

  8. struts2系列(二):struts2参数传递错误、struts2的输入错误验证

    一.struts2参数传递错误 1. 基本数据类型的传递最好使用包装类,原因是struts 2.1之后使用基本数据类型如果参数为空会报错2. 日期参数的传递最好定义一个区域的属性(定义locale), ...

  9. C# 各种输入格式验证#各种输入格式验证

    /// <summary> /// 各种输入格式验证 /// </summary> public class ValidateUtil { private static Reg ...

随机推荐

  1. 微信小程序开发05-日历组件的实现

    接上文:微信小程序开发04-打造自己的UI库 github地址:https://github.com/yexiaochai/wxdemo 我们这里继续实现我们的日历组件,这个日历组件稍微有点特殊,算是 ...

  2. CentOS 7 最小化安装配置以及网络服务器搭建、配置与管理

    一.环境介绍: 运行软件:VMware Workstation Pro 系统环境:CentOS-7-x86_64-1810 系统网络运行模式:NAT模式 二.操作配置: 1.配置动态获取IP 1) 修 ...

  3. There was a problem with the instance info replicator

    There was a problem with the instance info replicator 错误原因: 该服务尝试将自己作为客服端注册 解决办法: 在application.yml配置 ...

  4. nginx系列10:通过upstream模块选择上游服务器和负载均衡策略round-robin

    upstream模块的使用方法 1,使用upstream和server指令来选择上游服务器 这两个指令的语法如下图: 示例: 2,对上游服务使用keepalive长连接 负载均衡策略round-rob ...

  5. setTimeout与setInterval的区别浅析

    在网页制作动态效果时,一定会遇到某些需求,要求某段程序等待多时时间后再开始执行,就像在我们的生活中一样,待会儿再开始做一件事.在JavaScript中主要通过定时器实现此类需求,本文将对定时器做一个概 ...

  6. 使用WordPress制作微信小程序

    0 产品由来 微信小程序具有即来即用.轻量化.与微信贴合性好的特点.对于独立产品来说,使用微信小程序能够较好的服务与个人及现在的互联网社群,提升用户体验. 本次设计的微信小程序是面向无人机开发者社区的 ...

  7. CMMI 2.0术语变化

    过程域 vs. 实践域 “过程域”(Process Areas,PAs)在CMMI 2.0中变成了“实践域(Practice Areas,PAs)”.这样的改变,强调了CMMI 2.0是最佳实践的集合 ...

  8. linux 搭建squid代理服务器

    linux 搭建squid代理服务器 实验环境: 一台linux搭建Web服务器,充当内网web服务器(同时充当内网客户端) 202.100.10.100 一台linux系统充当网关服务器,两个网卡, ...

  9. jquery html() callback

    通过JQuery的.html()函数我们可以非常方便地加载一段HTML到指定的元素中,例如给<div></div>中放入一组图片.问题是JQuery的.html()函数是同步的 ...

  10. shell编程企业级实战

    如何才能学好Shell编程 为什么要学习shell编程 Shell是Linux底层核心 Linux运维工作常用工具 自动化运维必备基础课程 学好shell编程所需Linux基础 熟练使用vim编辑器 ...