当前位置: 首页 > news >正文

培训教育的网站怎么做ps培训

培训教育的网站怎么做,ps培训,益阳网站建设企业,wordpress ftp安装之前做得比较多的校验是在el-form表单里做的,但有时也遇到,需要在table内输入数据,然后校验输入的数据是否符合要求的情况。因此记录一下。 思路: 1.需要借助el-form的校验,el-table外层嵌套一层el-form,使…

之前做得比较多的校验是在el-form表单里做的,但有时也遇到,需要在table内输入数据,然后校验输入的数据是否符合要求的情况。因此记录一下。

思路:
1.需要借助el-form的校验,el-table外层嵌套一层el-form,使用el-form的校验机制
2.由于每行都需要校验,因此需要借助scope.$index
3.借助一个提交按钮,测试校验

效果:
1.不输入数据,直接点击“提交”触发校验,由于数据没有输入,校验不通过,给出校验提示
2.点击输入框输入,点击某一个字段,即正在输入状态,这个字段的校验结果就会被清除(clearValidate)
3.数据都填好之后,点击“提交”,再次触发校验
4.校验通过,显示全屏提示是否提交,点击“确定”即可,控制台会打印“校验通过

    <div id="app"><el-form class="base-form" ref="baseForm" :model="baseForm" :rules="rules" auto-complete="on"><el-table ref="table-input" class="table" highlight-current-row :data="baseForm.demoList"><el-table-column label="姓名" show-overflow-tooltip><template slot-scope="scope"><el-form-item :prop="'demoList.'+scope.$index+'.name'" :rules="rules.name" class="all"><el-input v-model="scope.row.name" placeholder="请输入" clearable @focus="$refs.baseForm.clearValidate(`demoList.${scope.$index}.name`)"></el-input></el-form-item></template></el-table-column><el-table-column label="年龄" show-overflow-tooltip><template slot-scope="scope"><el-form-item :prop="'demoList.'+scope.$index+'.age'" :rules="rules.age" class="all"><el-input v-model="scope.row.age" placeholder="请输入" clearable @focus="$refs.baseForm.clearValidate(`demoList.${scope.$index}.age`)"></el-input></el-form-item></template></el-table-column><el-table-column label="出生日期" show-overflow-tooltip><template slot-scope="scope"><el-form-item :prop="'demoList.'+scope.$index+'.birthday'" :rules="rules.birthday" class="all"><el-date-picker placeholder="请选择" v-model="scope.row.birthday" format="yyyy-MM-dd" clearable @focus="$refs.baseForm.clearValidate(`demoList.${scope.$index}.birthday`)"></el-date-picker></el-form-item></template></el-table-column><el-table-column label="详细地址" show-overflow-tooltip><template slot-scope="scope"><el-form-item :prop="'demoList.'+scope.$index+'.address'" :rules="rules.address" class="all"><el-input v-model="scope.row.address" placeholder="请输入" clearable @focus="$refs.baseForm.clearValidate(`demoList.${scope.$index}.address`)"></el-input></el-form-item></template></el-table-column></el-table></el-form><div class="flex-c-a margin-top-10"><el-button @click="submit">提交</el-button></div></div>

data数据

           baseForm: {demoList: [{name: "",age: "",birthday: "",address: ""}]},index: 0,rules: {name: [{required: true,message: "请输入姓名",trigger: "blur"}],age: [{ required: true, message: "请输入年龄", trigger: "blur" }],birthday: [{ required: true, message: "请选择出生日期", trigger: "change" }],address: [{ required: true, message: "请输入详细地址", trigger: "blur" }],}

method:
给一个提交按钮,测试校验

// 提交核对账目
submit() {this.$refs.baseForm.validate((valid) => {if (valid) {this.$confirm("您确定【提交】?", "提示", {confirmButtonText: "确定",cancelButtonText: "取消",type: "warning"}).then(() => {console.log("校验通过")})}})
}

例子里使用的css:

  .all {width: 100%;}.flex-c-a {display: flex;align-items: center;justify-content: space-around;}.margin-top-10 {margin-top: 10px;}.base-form.el-form-item__content {margin-left: 0;}

http://www.hkea.cn/news/502120/

相关文章:

  • wordpress时间云储存沈阳网站制作优化推广
  • h5响应式网站建设竞价托管哪家效果好
  • 企业解决方案参考网站品牌软文营销案例
  • 做淘客要有好的网站上海百度seo
  • 网站建设 seojsc宁德seo推广
  • 建立网站的作用信息流优化师工作总结
  • 如何建设物流网站近期时事新闻
  • 网站开发大赛发言稿网址搜索
  • 论坛类型的网站怎么做拉新推广平台有哪些
  • pc官方网站视频专用客户端app
  • 成都哪家做网站建设比较好搜索关键词排名查询
  • 无锡网站优化推广广州网站推广运营
  • 电子商务网站开发的步骤短视频seo排名系统
  • 如何用模板做网站视频河北电子商务seo
  • 动态网站代码设计做小程序的公司
  • 网站建设软件开发的新闻北京关键词优化报价
  • 在上海做兼职在哪个网站好百度售后电话人工服务
  • 深圳网站开发招聘谁能给我个网址
  • 长沙做个网站多少钱怎样免费给自己的公司做网站
  • wordpress to微博优化营商环境条例
  • 做外贸通常用哪些网站seo网站监测
  • 电子商务网站建设解决方案必应搜索引擎
  • 企业网页制作与网站设计南京seo优化培训
  • sqlite开发网站想做网络推广的公司
  • 网页设计作业在线网站首页seo教程seo优化
  • 做个网站多钱域名备案查询系统
  • 饰品网站模板官网seo关键词排名系统
  • 文学网站做编辑百度笔记排名优化
  • 公司网站开发语言如何优化百度seo排名
  • 做网站较好的框架惠州百度推广排名