vue element 可编辑表格行内验证
<template>
<div class="page-layout rataMdel">
<el-button type="primary" @click="addItem">+添加一行</el-button>
<el-form
:model="ruleForm"
ref="ruleForm"
label-width="100px"
class="demo-ruleForm"
>
<el-table :data="ruleForm.tableList" style="width: 100%">
<el-table-column prop="name">
<!-- 变量rules -->
<template slot-scope="scope">
<el-form-item
label="活动名称"
:prop="'tableList.' + scope.$index + '.name'"
:rules="rules.name"
>
<el-input v-model="scope.row.name"></el-input>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="region">
<!-- 行内rules -->
<template slot-scope="scope">
<el-form-item
label="活动区域"
:prop="'tableList.' + scope.$index + '.region'"
:rules="[{ required: true }]"
>
<el-select v-model="scope.row.region" placeholder="活动区域">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
</el-table>
</el-form>
<div style="margin-top: 20px">
<el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
</div>
</div>
</template> <script>
export default {
data() {
return {
ruleForm: {
tableList: []
},
rules: {
name: [
{ required: true, message: "请输入活动名称", trigger: "blur" },
{ min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
]
}
};
},
methods: {
addItem() {
this.ruleForm.tableList.push({
name: "",
region: ""
});
}, submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert("submit!");
} else {
console.log("error submit!!");
return false;
}
});
}
}
};
</script> <!-- <style lang='scss' scoped>
.rataMdel {
.el-table td {
padding: 6px 0;
}
.el-form-item__error {
display: none;
}
.header-flex {
display: flex;
align-items: center;
justify-content: space-between;
}
.tableTitle {
font-size: 20px;
margin-bottom: 30px;
}
.charts-box {
width: 100%;
display: flex;
justify-content: center;
}
.tableText {
padding: 15px;
font-size: 15px;
color: #333333;
}
.small-num {
display: inline-block;
width: 70px;
}
.small-string {
display: inline-block;
width: 130px;
}
p {
margin: 0;
padding: 0;
}
.el-form-item {
display: inline-block;
margin-bottom: 0px;
}
}
</style> -->
vue element 可编辑表格行内验证的更多相关文章
- vxe-table 可编辑表格 行内编辑以及验证 element-UI集成
<vxe-table border show-overflow ref="xTable" ----------------------------------------- ...
- AppBoxPro - 细粒度通用权限管理框架(可控制表格行内按钮)源码提供下载
特别声明: 提供的源代码已经包含了 AppBoxPro 的全部源代码,用 VS2012 打开项目后,直接 Ctrl+F5 可以运行起来(默认使用VS自带的LocalDB数据库). FineUIPro是 ...
- flask 自定义验证器(行内验证器、全局验证器)
自定义验证器 在WTForms中,验证器是指在定义字段时传入validators参数列表的可调用对象,下面来看下编写自定义验证器. 行内验证器 除了使用WTForms提供的验证器来验证表单字段,我们还 ...
- datatables表格行内编辑的实现
Datatables是一款jquery表格插件,它是一个高度灵活的工具,灵活就意味着很多功能需要自己去实现,比如说行内编辑功能. Datatables自己是没有行内编辑功能的,最简单的是通过modal ...
- vue+element ui 的表格列使用组件
前言:工作中用到 vue+element ui 的前端框架,有这个场景:很多表格的列有许多一样的,所以考虑将列封装为组件.转载请注明出处:https://www.cnblogs.com/yuxiaol ...
- Easyui 编辑表格行删除
1.问题描述 easyui 编辑表格新增一条数据后,删除最后一行删除不了,原因是没有提交数据acceptChanges. 源码中deleteRow方法,根据坐标获取行html,方法为opts.find ...
- bootstrap-table 数据表格行内修改
bootstrap-table 数据行内修改js中设置列的属性 editable : { type : 'text',//数据显示在文本框内 emptytext : "--",// ...
- Vue iview可编辑表格的实现
创建table实例页 views/table.vue <template> <h1>table page</h1> </template> <sc ...
- VUE+Element UI实现简单的表格行内编辑效果
原理是通过Css控制绑定的输入控件与显示值,在选中行样式下对控件进行隐藏或显示 <!DOCTYPE html> <html> <head> <meta cha ...
- element 表格行内进行编辑
<template> <div class="process_manage"> <el-card class="box-card" ...
随机推荐
- centos7无法下载nginx
centos7无法下载nginx 1.正常情况下:先下载epel-release 源然后安装yum install -y nginx2.如果不行,试着执行yum clean all &&a ...
- loj2511
引言 思维题. 这个做法跑得飞快,还不用 dp,也不是爆搜! 复杂度(可能)为 \(O(s^2t)\) 或 \(O(s^2)\),实际效率也是飞快. 不过这题我直接提交答案了. 思路 考虑 \(A=m ...
- staticmethod() 函数
title: staticmethod() 函数 author: 杨晓东 permalink: staticmethod date: 2021-10-02 11:27:04 categories: - ...
- C - Functions again CodeForces - 789C
C - Functions again CodeForces - 789C 这道题考查了对Map的运用 #include<iostream> #include<cstdio> ...
- Centos7提示Initial setup of CentOS Linux 7 (core)
Initial setup of CentOS Linux 7 (core) 1) [x] Creat user 2) [!] License information (no user will be ...
- 新的学习历程-python2 print
1 print('hello world!') 2 print('hello','world!') #逗号自动添加默认的分隔符:空格 3 print('hello'+'world!') #加号表示字符 ...
- LP1-5:流程与沟通
口头沟通,整理归档,落到文档或JIRA任务中 JIRA上的需求有对应任务,开发任务对应需求任务号,测试任务号对应开发任务,上线任务对应测试及开发任务. 需求说明 :每个版本有什么功能. 控制需求三要素 ...
- KMP 算法实现
# coding=utf-8 def get_next_list(findding_str): # O(m) # 求一个字符串序列每个位置的最长相等前.后缀 j = 0 # 最长相等前缀的末位 nex ...
- Java密码加密的两种保存方式
密码加密的两种方式(md5和base64) 常见的加密方式有盐值,md5和jdk自带的base64,这里我记录的是base64如何使用,以及破解的方式,话不多说,直接贴代码! 其实md5和加盐值都差不 ...
- python 通过win32com操作vcf到outlook中,同时解决乱码问题
之前用的黑莓手机,故障后换了iphone,后来还是想用上黑莓Q10.于是有了该文章. 问题: 如何将iphone上的通讯录导入黑莓? 网上回答1:通过icloud将iphone中的通讯录导入黑莓手机. ...