zoukankan      html  css  js  c++  java
  • 一个随时更新的js库

    1.src同级建commFunction=》timer.js

    2.main.js引入

    import time from '../commonFunction/time'
    Vue.prototype.time=time
    =======================================

    情况一1.时间戳

    // 时间戳转时间 2020-4-24 00:30:00
        timeStamp(val) {
            val = val.toString()
            if(val.length == 10) {
              let time = val * 1000;
              let timestamp4 = new Date(time);
              return (timestamp4.toLocaleDateString().replace(///g, "-") +" " + timestamp4.toTimeString().substr(0, 8));
            } else {
              let timestamp4 = new Date(val);
              return (timestamp4.toLocaleDateString().replace(///g, "-") +" " +timestamp4.toTimeString().substr(0, 8));
            }
        },
        // 2017-4-8 14:11:33转2017-04-08 14:11:33
        handeldate(m){
            let o = m[0]+m[1]+m[2]+m[3]
            if(m.length==18){
                if(m[6]=='-'){
                    return o+m[4]+'0'+m[5]+m[6]+m[7]+m[8]+m.slice(9)
                }
                if(m[7]=='-'){
                    return o+m[4]+m[5]+m[6]+m[7]+'0'+m[8]+m.slice(9)
                }
            }else if(m.length==17){
                return o+m[4]+'0'+m[5]+m[6]+'0'+m[7]+m.slice(8)
            }else{
                return m
            }
        }
    页面使用:
    appList.forEach(element => {
                  element.create_time = this.time.handeldate(this.time.timeStamp(element.create_time))
                });
  • 相关阅读:
    i3wm菜单
    开始写博客拉
    xterm配置
    Linux Tips
    docker下运行labview2010
    oracle连接字符串解析
    C# 域登录实现
    解决Winform程序在不同分辨率系统下界面混乱
    FTP设置:FTP隔离用户
    sqlserver 启动不了sqlserver服务,提示特定服务错误代码10048
  • 原文地址:https://www.cnblogs.com/wd163/p/13213773.html
Copyright © 2011-2022 走看看