zoukankan      html  css  js  c++  java
  • Mint-UI组件 MessageBox为prompt 添加判断条件

    这篇文章较早,参考时请优先查看官方文档API源码

    Mint-UI 的Message Box 是prompt类型时,可以添加正则判断或者function判断条件。具体可以查看Mint-UI源码。

    添加正则判断条件:

    MessageBox({
        $type:'prompt',
        title:'输入验证码',
        message:'请填写您收到的验证码',
        closeOnClickModal:false,   //点击model背景层不关闭MessageBox
        showCancelButton:false,   //不显示取消按钮
        inputPattern:/^[a-zA-Z0-9]{6}$/,    //正则条件
        inputErrorMessage:'请输入正确的验证码',
        showInput:true
    }).then(({ value, action }) => {
        /* value 为填写的值,进行下一步操作*/
        console.log(value);
    });

    添加function判断条件

    MessageBox({
        $type:'prompt',
        title:'输入验证码',
        message:'请填写您收到的验证码',
        closeOnClickModal:false,    //点击model背景层不关闭MessageBox
        showCancelButton:false,     //不显示取消按钮
        inputValidator:function(v){return /^[a-zA-Z0-9]{6}$/.test(v);},  //function可以用来写更复杂的判断条件,返回布尔值
        inputErrorMessage:'请输入正确的验证码',
        showInput:true
    }).then(({ value, action }) => {
        /* value 为填写的值,进行下一步操作 */
        console.log(value);
    });

  • 相关阅读:
    Live Writer配置
    protobufnet 学习手记
    好的Sql语句也能提高效率(二)
    关于CodeSmith的输出问题
    [Scrum]12.29
    [scrum] 1.4
    分享 关于c#注释的规范
    [Scrum] 1.3
    分享:将XML(VS提取注释时生成)转换为Chm的一个方法
    【Scrum】2010.12.27
  • 原文地址:https://www.cnblogs.com/zling-gnilz/p/8532479.html
Copyright © 2011-2022 走看看