zoukankan      html  css  js  c++  java
  • 提现金额需要满足条件js判断

    // 解决首位直接输入 '0开头的数字'问题
    this.inputModel = this.inputModel.toString() + curVal.toString()
    this.inputModel = this.inputModel.replace(/[^d.]/g,""); //清除“数字”和“.”以外的字符
    this.inputModel = this.inputModel.replace(/.{2,}/g,"."); //只保留第一个. 清除多余的
    this.inputModel = this.inputModel.replace(".","$#$").replace(/./g,"").replace("$#$",".");
    this.inputModel = this.inputModel.replace(/^(-)*(d+).(dd).*$/,'$1$2.$3') //保留2位小数
    if(this.inputModel.indexOf(".")< 0 && this.inputModel !=""){//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
    this.inputModel= parseFloat(this.inputModel);
    }
    //判断不能输入最大值
    if(this.maxValue > 0 && this.maxValue < this.inputModel) {
    this.inputModel = this.maxValue
    }
    const inputVal = this.inputModel
    const len = inputVal.length
    if(len == 1 && inputVal.charAt(0) == '.') {
    this.inputModel = ''
    }
    

      

  • 相关阅读:
    多态性与转型
    安装tensorflow
    MySQL基础补缺
    各种排序算法理解
    Ubuntu命令行变成白色
    开机显示grub命令
    E: 无法获得锁 /var/lib/dpkg/lock-frontend
    类与方法
    Java语言浅谈
    二进制数的有效讨论
  • 原文地址:https://www.cnblogs.com/cyf-1314/p/11477093.html
Copyright © 2011-2022 走看看