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属性

    
    
  • 相关阅读:
    D. The Fair Nut and the Best Path 树形dp (终于会了)
    (二)网络流之最大流
    网络流(知识点) 一 终究还是躲不掉
    dp 优化 F2. Pictures with Kittens (hard version)
    da shu mo ban
    AtCoder Regular Contest 090 F
    Codeforces 918D MADMAX 图上dp 组合游戏
    Codeforces 918C The Monster
    AtCoder Regular Contest 090 C D E F
    poj 3623 Best Cow Line, Gold 后缀数组 + 贪心
  • 原文地址:https://www.cnblogs.com/TimerHotel/p/vue_09.html
Copyright © 2011-2022 走看看