<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 可编辑表格行内验证的更多相关文章

  1. vxe-table 可编辑表格 行内编辑以及验证 element-UI集成

    <vxe-table border show-overflow ref="xTable"  ----------------------------------------- ...

  2. AppBoxPro - 细粒度通用权限管理框架(可控制表格行内按钮)源码提供下载

    特别声明: 提供的源代码已经包含了 AppBoxPro 的全部源代码,用 VS2012 打开项目后,直接 Ctrl+F5 可以运行起来(默认使用VS自带的LocalDB数据库). FineUIPro是 ...

  3. flask 自定义验证器(行内验证器、全局验证器)

    自定义验证器 在WTForms中,验证器是指在定义字段时传入validators参数列表的可调用对象,下面来看下编写自定义验证器. 行内验证器 除了使用WTForms提供的验证器来验证表单字段,我们还 ...

  4. datatables表格行内编辑的实现

    Datatables是一款jquery表格插件,它是一个高度灵活的工具,灵活就意味着很多功能需要自己去实现,比如说行内编辑功能. Datatables自己是没有行内编辑功能的,最简单的是通过modal ...

  5. vue+element ui 的表格列使用组件

    前言:工作中用到 vue+element ui 的前端框架,有这个场景:很多表格的列有许多一样的,所以考虑将列封装为组件.转载请注明出处:https://www.cnblogs.com/yuxiaol ...

  6. Easyui 编辑表格行删除

    1.问题描述 easyui 编辑表格新增一条数据后,删除最后一行删除不了,原因是没有提交数据acceptChanges. 源码中deleteRow方法,根据坐标获取行html,方法为opts.find ...

  7. bootstrap-table 数据表格行内修改

    bootstrap-table 数据行内修改js中设置列的属性 editable : { type : 'text',//数据显示在文本框内 emptytext : "--",// ...

  8. Vue iview可编辑表格的实现

    创建table实例页 views/table.vue <template> <h1>table page</h1> </template> <sc ...

  9. VUE+Element UI实现简单的表格行内编辑效果

    原理是通过Css控制绑定的输入控件与显示值,在选中行样式下对控件进行隐藏或显示 <!DOCTYPE html> <html> <head> <meta cha ...

  10. element 表格行内进行编辑

    <template> <div class="process_manage"> <el-card class="box-card" ...

随机推荐

  1. Office2021简体中文离线安装包下载地址合集,目前最全

    Office2021中文版的离线安装包下载地址合集: 一.专业增强版(强烈推荐):http://officecdn.microsoft.com/pr/492350f6-3a01-4f97-b9c0-c ...

  2. js-解决安卓手机软键盘弹出后,固定定位布局被顶上移问题

    分析:软键盘弹出后,导致页面高度变化 解决方案:软键盘弹出后,修复页面高度 // 监听窗口变化 resizeScreen(){ if (!this.state.isIOS && thi ...

  3. WPF使用WindowChrome自定义标题栏

    第一步:基本实现 添加Window的Style定义,并设置WindowChrome.WindowChrome属性: 设置WindowChrome标题栏: CaptionHeight--主要用于拖动有效 ...

  4. 1487. 保证文件名唯一 (Medium)

    问题描述 1487. 保证文件名唯一 (Medium) 给你一个长度为 n 的字符串数组 names .你将会在文件系统中创建 n 个文件夹:在第 i 分钟,新建名为 names[i] 的文件夹. 由 ...

  5. 最全面 think php 实现微信公众号回复编号进行投票,自定义菜单功能

    前期准备工作 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messag ...

  6. [后端-python实战总结]-chapter1-python基础01

    1.1 week 1 > 密码秘文: import getpass username = input('username:') passwd = getpass.getpass('passwd: ...

  7. SpringMVC学习笔记【狂神说】

    1.MVC是什么 MVC是模型(Model).视图(View).控制器(Controller)的简写,是一种软件设计规范. 是将业务逻辑.数据.显示分离的方法来组织代码. MVC主要作用是降低了视图与 ...

  8. pytest框架增加log打印(包括pytest的执行结果、自定义的log信息)

    前言: 之前同事在跑脚本的时候报错了,发现没法把需要的log信息打印出来,我这边定位问题比较麻烦,所以增加了log的打印.这个问题之前已经处理过了,本来以为是小问题,结果今天又要用到这个小技巧的时候居 ...

  9. 04_Linux完全卸载安装Mysql

    1.Linux环境完全卸载mysql相关文件: 完全卸载mysql相关文件:             yum remove mysql mysql-server mysql-libs compat-m ...

  10. 浅谈zookeeper

    zookeeper用来解决高可用问题,具有高可用,高性能,具有严格的顺序(只要是分布式系统就会是一个严格的顺序)访问控制能力的分布式协调服务,做分布式协调的作用,可以做服务的同步,维护配置文件和命名服 ...