zoukankan      html  css  js  c++  java
  • 随手记录

    关于VUE 安装包  报 request to https://registry.cnpmjs.org/xx    failed 的问题

    用淘宝镜像  

      npm config set registry https://registry.npm.taobao.org

    然后在安装想要的插件包

      npm install --save xx

    vue接受和处理window.location.href方式传来的字符串参数

     
    this.$route.query.id.split('_');(split把参数转成数组)
     
    vue  input标签 number类型,在ios系统还能输入汉字解决办法,在标签上添加一下逻辑
     
    onkeyup="value=value.replace(/[^0-9]/g,'')" onpaste="value=value.replace(/[^0-9]/g,'')" oncontextmenu = "value=value.replace(/[^0-9]/g,'')"
     
    防止字符全空格
      str.replace(/s/g, "")   方法1
      str.trim()      方法2
     
    时间比较大小
      let time = (new Date()).valueOf()
      if(  time  > (new Date(this.joinstart.replace(/-/g, '/'))).valueOf()){
                                    this.$dialog.toast({
                                        mes: '报名时间必须大于当前时间',
                                        timeout: 1500,
                                    });
                                    return false;
                                }
     
    img获取图片大小 load方法
    @load='aa'
     
    aa(event){event.target.width}
     
    截取Number类型小数点后两位
    Math.floor(num* 100) / 100
    Math.floor((parseFloat(parseFloat(item.old_fee)*100-parseFloat(item.fee)*100))) / 100    html里计算 防止浮点数
      
    获取当日凌晨的时间戳,拼接一天的秒数-1,获取该日期的当日的最后一秒,可用于web端进行当日首次的进入的判断
    var timestamp3 = new Date(new Date().setHours(0, 0, 0, 0)) / 1000 + 86399;
    if(timestamp3 >localStorage.getItem('userTime') || localStorage.getItem('userTime') ==null){
        localStorage.setItem('userTime',timestamp3)
         this.galleryTips = true
         }else{
         console.log( this.galleryTips)
         }
     
     
  • 相关阅读:
    [转载]小谈网络游戏同步
    [ASE][Daily Scrum]11.06
    [Proposal]Tank Battle——Infinite
    [proposal][app]Watch your time!
    [Proposal]Nano-Diary(纳日记)
    LaTeX中用BibTex管理参考文献
    matlab化简符号表达式
    placeholder颜色变化
    链接图片外边出现蓝框(IE8/IE9/IE10)
    图标排列
  • 原文地址:https://www.cnblogs.com/cp123/p/11993143.html
Copyright © 2011-2022 走看看