zoukankan      html  css  js  c++  java
  • Element组件,v-for循环,表单验证方法

    HTML

    <el-row v-for="(item, idx) in profession.custs" :key="-idx" class="pro-card contacts s1">
        <el-row>
            <el-col>
                <el-form-item label="联系人电话" :prop="'custs.'+idx+'.custPhone'" :rules="rules.custPhone">
                    <el-input v-model="item.custPhone" placeholder="请输入联系人电话"></el-input>
                </el-form-item>
            </el-col>
        </el-row>
    </el-row>

    DATA

    profession: {
                // 联系人列表信息
                custs:[{
                    custRela: '',//联系人类型
                    custName: '',//联系人名称
                    custPhone: '',//联系人电话
                }],
    }

    校验规则 

    //校验规则
    rules:{
        'custPhone':[
            {pattern: /^1(?:3d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8d|9d)d{8}$/, message: '请输入正确的格式', trigger: ['blur','change']},
        ]
    },

      

  • 相关阅读:
    JavaEE高级-JPA学习笔记
    jQueryrocket
    jQueryrocket
    jQueryrocket
    jQueryrocket
    jQueryrocket
    jQueryrocket
    jQueryrocket
    jQueryrocket
    jQueryrocket
  • 原文地址:https://www.cnblogs.com/sonwrain/p/12761341.html
Copyright © 2011-2022 走看看