<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. 自定义view,用来测试屏幕

    public class BezierGestureTrackView extends View { private Bitmap mBufferBitmap; private Canvas mBuf ...

  2. ImportError: cannot import name 'six' from 'django.utils'的解决办法

    解决办法 对于3.x版本的django,安装django-utils-six2.0 pip install django-utils-six

  3. vscode 开发c++

    makefile.mk #makefile.mk 公共头文件 ifndef TARGET # /root/make/src/test_include # notdir TARGET:=$(notdir ...

  4. Matplotlib 实现画中画

    需要导入的包 inset_axes 要实现画中画,即在原画轴上添加新轴,需要用到mpl_toolkits.axes_grid1.inset_locator的inset_axes. 基本用法 new_a ...

  5. c++的double转string(转)

    原文地址:https://www.cnblogs.com/finallyliuyu/p/1810071.html c++中double转换成string型(浮点数的格式化)(转)   在日常编程中-- ...

  6. vim学习小结

    参考书籍<Linux 从入门到精通>第二版(刘忆智 等编著) Vim编辑器 背景:Vim的设计哲学就是让使用者能够在主键盘区完成所有工作. vim是vi的增强版本,vim分为插入和命令两种 ...

  7. 《CSOL大灾变》Mobile移植记录——购买区域

    在CSOL大灾变模式中,购买武器只能出现在特定区域,如下:    这里可以通过添加一些不渲染的BOX(如图中的蓝色BOX)作为触发器,然后检测玩家与之触发后才能弹出购买菜单. 在JmonkeyEngi ...

  8. Python爬取三国演义章节标题和内容(bs4爬取,解决中文乱码)

    import os.path import requests from bs4 import BeautifulSoup if __name__ == '__main__': if not os.pa ...

  9. go简单写个ini配置文件读取工具

    直接上代码: 1 package main 2 3 import ( 4 "fmt" 5 "io/ioutil" 6 "reflect" 7 ...

  10. win10:你需要来自XXXX的权限才能对此文件夹进行更改

    转载请注明来源:https://www.cnblogs.com/Sherlock-L/p/16769720.html 起因 软件运行失败,看报错信息是删除某个文件夹失败了,行吧,我自己来删.找到目标文 ...