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 = ''
    }
    

      

  • 相关阅读:
    log4j日志配置
    map和java对象的转换方法
    阿里巴巴的json使用时的一些转换方法
    HttpClient发送Post和Get请求
    IT网站导航
    python学习
    git解决冲突
    协程
    Python实现协程
    异步任务神器 和定时任务Celery
  • 原文地址:https://www.cnblogs.com/cyf-1314/p/11477093.html
Copyright © 2011-2022 走看看