zoukankan      html  css  js  c++  java
  • 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属性

    
    
  • 相关阅读:
    Ajax实现动态的二级级联菜单
    使用 Struts 2 实现国际化
    使用 Struts2 校验器校验用户注册信息
    Python基础 9.正则
    Python基础 8.迭代器 生成器 包
    Python基础 7.异常
    Python基础 6 .文件操作
    Python基础 5.类
    Python基础 4.函数
    Python基础 3 控制流程
  • 原文地址:https://www.cnblogs.com/TimerHotel/p/vue_09.html
Copyright © 2011-2022 走看看