element-plus关于表单数据自定义参数校验

element-plus关于表单数据自定义参数校验

核心点:

代码:

html 复制代码
<el-form-item :prop="'tableData[' + scope.$index + '].score'"
    :rules="[
      { required: true, message: '得分不能为空', trigger: 'blur' },
      { validator:  (rule: any, value: any, callback: any) =>{ validateScore(rule,value,scope.row.defaultScore,callback)}, trigger: 'blur' }
     ]"
    style="margin-bottom: 0px !important;">
	  <el-input
	    style="width: 70px"
	    placeholder="得分"
	    v-model="tableFrom.tableData[scope.$index].score"
	    type="number"
	    min="0"
	    :max="scope.row.defaultScore"
	  />
</el-form-item>

主要是需要自己在rules定义,而不能像我们之前定义一个大的数组放在一起

相关推荐
Liu.7742 天前
Vue3 中如何使用 GET 请求传递复杂参数
vue.js·vue3
RuoyiOffice3 天前
Spring AI+Vue3 企业知识库设计:让每个答案有依据,让每份资料守住权限
java·spring boot·vue3·rag·企业知识库·spring ai·ruoyi office
RuoyiOffice4 天前
SpringBoot3+Vue3 员工全生命周期:入转调离如何衔接账号、权限、资产与交接
spring boot·vue3·权限管理·员工管理·hrm·ruoyi office·人事变更
RuoyiOffice5 天前
SpringBoot3+Vue3 企业 AI 工作流:Tinyflow 画布、LLM 节点与在线试跑怎么落地
spring boot·大模型·vue3·agent·ai工作流·ruoyi office·tinyflow
RuoyiOffice5 天前
Springboot + Vue3 + FormCreate表单引擎,直接用AI对话进行单据设计,告别拖拽画表单
spring boot·低代码·vue3·sse·formcreate·ruoyi office·ai表单
RuoyiOffice8 天前
SpringBoot+Vue3+Onlyoffice 企业文件生命周期:上传、业务关联、权限、版本与安全清理
spring boot·vue3·文件管理·对象存储·权限控制·ruoyi office·附件管理
格数致用11 天前
03- Luckysheet与Vue3+Electron集成实战指南
electron·vue3·luckysheet
雪芽蓝域zzs13 天前
第7节:多选模式、自定义选项渲染、受控弹窗显隐
vue.js·elementui
雪芽蓝域zzs14 天前
第6节:远程搜索弹窗(remote 模式),弹窗滚动加载分页
vue.js·elementui
雪芽蓝域zzs15 天前
第4节:el-select 弹窗事件控制(打开 / 关闭、选中事件、弹窗滚动事件)
vue.js·elementui