• 9.Element-ui的校验规则Rules


    Element-ui的校验规则Rules

    <el-form label-position="left" label-width="80px" :model="user" ref="user" :rules="rules">
                <el-form-item label="手机号" prop="phone">
                    <el-input v-model="user.phone"></el-input>
                </el-form-item>
                <el-form-item label="密码" prop="password">
                    <el-input v-model="user.password" type="password"></el-input>
                </el-form-item>
                <el-form-item label="确认密码" prop="pass">
                    <el-input v-model="user.pass" type="password"></el-input>
                </el-form-item>
                <el-form-item label="真实姓名" prop="member.name">
                    <el-input v-model="user.member.name"></el-input>
                </el-form-item>
                <el-form-item label="身份">
                    <el-radio-group v-model="user.member.type">
                        <el-radio :label="false">学生</el-radio>
                        <el-radio :label="true">教职工</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="学院" prop="member.dep">
                    <el-input v-model="user.member.dep"></el-input>
                </el-form-item>
                <el-form-item label="专业" prop="member.pro">
                    <el-input v-model="user.member.pro"></el-input>
                </el-form-item>
                <el-form-item label="班级" v-if="!user.member.type" prop="member.team">
                    <el-input v-model="user.member.team"></el-input>
                </el-form-item>
                <el-form-item label="转出机构" v-if="user.member.addType" prop="relation.outOrganization">
                    <el-input v-model="user.relation.outOrganization"></el-input>
                </el-form-item>
                <el-form-item label="转出日期" v-if="user.member.addType" prop="relation.outDate">
                    <el-date-picker type="date" value-format="yyyy-MM-dd" placeholder="转出日期" v-model="user.relation.outDate" style=" 100%;"></el-date-picker>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="validate('user')">注册</el-button>
                    <el-button @click="back">返回</el-button>
                </el-form-item>
    </el-form>
    

    注意form标签的 model、ref、rules三个属性

    注意form-item标签上的prop属性

    
    
  • 相关阅读:
    shell脚本中判断上一个命令是否执行成功
    nginx 414 Request-URI Too Large
    nginx 重写URL尾部斜杠
    Linux shell 日期,时间相关的命令
    shell脚本中自定义日志记录到文件
    scanf后面跟一个getchar
    1.Tarball软件make与makefile详解(还需要补充)
    <>和“”的区别
    malloc,calloc,realloc,alloc
    toString()方法细节
  • 原文地址:https://www.cnblogs.com/TimerHotel/p/vue_09.html
Copyright © 2020-2023  润新知