Blame view

src/utils/formatNum.js 968 Bytes
9a83dd61   liuqimichale   全局注册util方法
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  // export function formatNum(str) {
  //   var newStr = "";
  //   var count = 0;
  //   for (var 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++;
  //   }
  //   str = newStr;
  //   return str;
  //
  // }
  
  function formatNumArr(str) {
0e3a2706   liuqimichale   地图 title
19
20
21
    // console.log(typeof str)
    // console.log(str)
    var str = (str).toString();
841f35d2   liuqimichale   filter
22
23
24
25
26
27
28
29
30
31
32
33
    var newStr = "";
    var count = 0;
    for (var 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++;
    }
    str = newStr;
9a83dd61   liuqimichale   全局注册util方法
34
    str = str.split('')
841f35d2   liuqimichale   filter
35
36
37
    return str;
  
  }
9a83dd61   liuqimichale   全局注册util方法
38
  
9f216986   liuqimichale   弹窗
39
40
41
42
43
44
45
46
47
  function formatChanging(val) {
    console.log(val)
    let tmpHtml = '';
    for(let i=0;i<val.length;i++){
      tmpHtml += "<li>"+val[i].standard+"</li>"
    }
    return tmpHtml
  }
  
9a83dd61   liuqimichale   全局注册util方法
48
  export default {formatNumArr}