首页 > Web开发 > 详细

js变态需求

时间:2020-09-16 14:36:56      阅读:48      评论:0      收藏:0      [点我收藏+]
 //手机号格式 3-4-4 不验证手机号码:
    Mobile_input(type){
      if(type === "recvMobile"){
        var value = this.erp_register_msg.recvMobile;
      }else if(type === "fapiaoRecvMobile"){
        var value = this.erp_register_msg.fapiaoRecvMobile;
      }
      value = value.replace(/[^0-9]/ig, ""); 
      var arr = value.split(‘‘);
      if (arr.length >= 4) {
        arr.splice(3, 0, ‘ ‘);
      } 
      if (arr.length >= 9) {
        arr.splice(8, 0, ‘ ‘);
      }
      value = arr.join(‘‘);

     if(type === "recvMobile"){
        this.erp_register_msg.recvMobile = value;
      }else if(type === "fapiaoRecvMobile"){
        this.erp_register_msg.fapiaoRecvMobile = value;
      }

    },
    //不能输中文
    chinaese_input(){
      this.erp_register_msg.creditCode = this.erp_register_msg.creditCode.replace(/[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/g,‘‘); 
    },
    //不能输入中文和字母
    limt_chinaese_english(){
      this.erp_register_msg.phone=this.erp_register_msg.phone.replace(/[\u4E00-\u9FA5]|[A-Za-z]/g,‘‘);
    },
    //只能输入数字
    limt_number(){
       this.erp_register_msg.bankAccount = this.erp_register_msg.bankAccount.replace(/[^\d]/g,‘‘);
    }

 

js变态需求

原文:https://www.cnblogs.com/swt-axios/p/13678912.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!