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定义,而不能像我们之前定义一个大的数组放在一起

相关推荐
RuoyiOffice1 天前
SpringBoot3+Vue3 接口访问日志实战:@ApiAccessLog 慢接口、参数脱敏与 OperateLog 如何分工
spring boot·vue3·traceid·spring boot 3·访问日志·apiaccesslog·操作日志
tryCbest2 天前
Vue3项目在Nginx中配置代理后端IP
nginx·vue3
glustful4 天前
企业内部审计项目管理 系统开源(springboot+vue3)
vue3·springboot
RuoyiOffice4 天前
SpringBoot3+Vue3 会议室预订系统:时段冲突三模式检测 + 会前定时提醒与 cancelByBiz
spring boot·vue3·flowable·消息中心·spring boot 3·会议室·时段冲突
燐妤5 天前
中老年智能健康管理项目
python·ai·pycharm·vue3·fastapi·项目开发·健康
Sterting5 天前
Form表单与校验
javascript·vue.js·elementui
gis开发之家6 天前
《Vue3 从入门到大神50篇》Vue3 源码详解(二十):生命周期钩子源码解析 —— onMounted / onUpdated 如何实现?
前端·javascript·前端框架·vue3·vue3源码
Sterting6 天前
Element-Plus 入门与整体布局
前端·vue.js·elementui
yume_sibai7 天前
Element Plus 基础组件完全指南(12个核心组件)
前端·elementui
di24k24k13 天前
多个 el-form 共用同一 ref 导致表单校验部分失效
前端·javascript·vue.js·elementui