zoukankan      html  css  js  c++  java
  • antd 表单的两种校验方式

    1.声明式表单验证:

                            <Form.Item
                                name="username"
                                rules={[
                                    {
                                        required: true,
                                        message: 'Please input your Username!',
                                    },
                                    {
                                        max: 20,
                                        message: '最长20位!',
                                    },
                                    {
                                        min: 5,
                                        message: '至少5位!!',
                                    },                                {
                                        pattern: /^[A-Za-zd_]+$/,
                                        message: '自能包含字母数字下划线字符!',
                                    },
                                ]}
                            >
                                <Input prefix={<UserOutlined className="site-form-item-icon" />} placeholder="Username" />
                            </Form.Item>
    

      

    2. validator自定义式验证:

                            <Form.Item
                                name="password"
                                rules={[
                                    {
                                        validator: (_, value) =>{
                                        if(value.length >= 6 && value.length<=10) {
                                            return Promise.resolve()
                                        }else{
                                            return Promise.reject('密码长度必须是6~10位')
                                        }
                                      }
                                    }
                                ]}
                            >
                                <Input
                                    prefix={<LockOutlined className="site-form-item-icon" />}
                                    type="password"
                                    placeholder="Password"
                                />
                            </Form.Item>
    

      

  • 相关阅读:
    modis数据处理的坑(MOD02,mod03,mod04,MCD19A2)
    TensorFlow安装笔记(CPU版)
    mod35云掩膜产品用法
    ERA-Interim数据学习
    收集空气质量数据走的路
    GEE windows 环境配置
    Spatiotemporal continuous estimates of PM2.5 concentrations in China, 2000–2016: A machine learning method with inputs from satellites, chemical transport model, and ground observations
    Exploiting ConvNet Diversity for Flooding Identification
    Missing Data Reconstruction in Remote Sensing Image With a Unified Spatial–Temporal–Spectral Deep Convolutional Neural Network(缺失数据补全,时空谱网络)
    多线程
  • 原文地址:https://www.cnblogs.com/jlyuan/p/12774414.html
Copyright © 2011-2022 走看看