Blame view

src/utils/formate.js 999 Bytes
0afb4b58   liuqimichale   headertime
1
  function formateday() {
49ed5b07   liuqimichale   headertime
2
3
4
5
    let date = new Date()
    let str = ''
    let year = date.getFullYear()
    let month = date.getMonth()+1<10? "0"+ (date.getMonth()+1) : date.getMonth()+1
43352ba2   liuqimichale   数字处理
6
    let day = date.getDate()<10 ? "0"+date.getDate() : date.getDate()
0afb4b58   liuqimichale   headertime
7
8
9
    str = year +"-"+ month +"-"+ day
    return str
  }
3e5ad56c   liuqimichale   日期
10
  
0afb4b58   liuqimichale   headertime
11
12
13
  function formateTime() {
    let date = new Date()
    let str = ''
49ed5b07   liuqimichale   headertime
14
15
16
17
    let hours = date.getHours()<10? "0"+date.getHours() : date.getHours()
    let minutes=date.getMinutes()<10 ? "0"+date.getMinutes() : date.getMinutes();
    let seconds=date.getSeconds()<10 ? "0"+date.getSeconds() : date.getSeconds();
  
0afb4b58   liuqimichale   headertime
18
    str = hours+":"+minutes+":"+seconds
49ed5b07   liuqimichale   headertime
19
20
21
    return str
  }
  
f9b345a2   liuqimichale   全局filters
22
  function formaterTotal(val) {
43352ba2   liuqimichale   数字处理
23
24
25
26
27
28
29
30
31
32
33
34
    let str = val.toString()
    let newStr = ''
    let count = 0
    for(let i=str.length-1;i>=0;i--){
      if(count % 3 == 0 && count!= 0){
        newStr = str.charAt(i)+","+newStr
      }else{
        newStr = str.charAt(i)+newStr
      }
      count++
    }
    return newStr.split("")
f9b345a2   liuqimichale   全局filters
35
36
37
  }
  
  export  { formateday, formateTime, formaterTotal }