|
@@ -1,12 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="count-item">
|
|
<div class="count-item">
|
|
|
<span class="title">{{ title }}</span>
|
|
<span class="title">{{ title }}</span>
|
|
|
- <div class="count-content">
|
|
|
|
|
- <span v-for="num in nums" :class="num == ',' ? 'separator' : num == 0 ? 'zero num' : 'num'">{{ num }}</span>
|
|
|
|
|
- <!-- <span v-if="nums.length < 7">个</span>
|
|
|
|
|
- <span v-if="nums.length > 7">万</span>-->
|
|
|
|
|
- <span v-text="isMore?'万':'个'"></span>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <span v-for="num in nums" :class="num == ',' ? 'separator' : 'num'">{{ num }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
@@ -21,30 +16,14 @@
|
|
|
type: String
|
|
type: String
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- data () {
|
|
|
|
|
- return {
|
|
|
|
|
- isMore: false
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
formatNumber (num) {
|
|
formatNumber (num) {
|
|
|
- console.log(num)
|
|
|
|
|
let re = /(\d+)(\d{3})/
|
|
let re = /(\d+)(\d{3})/
|
|
|
- if (num > 9999) {
|
|
|
|
|
- this.isMore = true
|
|
|
|
|
- let str = num.toString()
|
|
|
|
|
- num = Math.floor(num / 10000)
|
|
|
|
|
- if (parseInt(str.charAt(str.length - 4)) > 4) {
|
|
|
|
|
- num = num + 1
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- num = (Array(7 - String(num).length).join(0) + num)
|
|
|
|
|
|
|
+ num = (Array(10 - String(num).length).join(0) + num)
|
|
|
while (re.test(num)) {
|
|
while (re.test(num)) {
|
|
|
- num = num.replace(re, '$1,$2')
|
|
|
|
|
|
|
+ num = num.replace(re, '$1,$2')
|
|
|
}
|
|
}
|
|
|
- num = num.split('')
|
|
|
|
|
-// console.log(num)
|
|
|
|
|
- return num
|
|
|
|
|
|
|
+ return num.split('')
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -63,58 +42,26 @@
|
|
|
|
|
|
|
|
.title {
|
|
.title {
|
|
|
display: inline-block;
|
|
display: inline-block;
|
|
|
- width: 58px;
|
|
|
|
|
|
|
+ width: 60px;
|
|
|
float: left;
|
|
float: left;
|
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
|
- line-height: 40px;
|
|
|
|
|
- color: #fff;
|
|
|
|
|
- font-size: 14px;
|
|
|
|
|
}
|
|
}
|
|
|
.separator, .num {
|
|
.separator, .num {
|
|
|
display: inline-block;
|
|
display: inline-block;
|
|
|
}
|
|
}
|
|
|
.separator {
|
|
.separator {
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
- color: #6cb7f3;
|
|
|
|
|
- line-height: 38px !important;
|
|
|
|
|
- margin: 0 5px 0 -5px;
|
|
|
|
|
- width: 3px;
|
|
|
|
|
- }
|
|
|
|
|
- .count-content{
|
|
|
|
|
- width: 145px;
|
|
|
|
|
- background: #fff;
|
|
|
|
|
- float: right;
|
|
|
|
|
- height: 30px;
|
|
|
|
|
- margin-top: 5px;
|
|
|
|
|
- margin-right: 5px;
|
|
|
|
|
- span{
|
|
|
|
|
- float: left;
|
|
|
|
|
- line-height: 24px;
|
|
|
|
|
- font-weight: bold;
|
|
|
|
|
- }
|
|
|
|
|
- span.zero{
|
|
|
|
|
- color: #bbdffb;
|
|
|
|
|
- }
|
|
|
|
|
- span:first-child{
|
|
|
|
|
- margin-left: 3px;
|
|
|
|
|
- }
|
|
|
|
|
- span:last-child{
|
|
|
|
|
- line-height: 30px;
|
|
|
|
|
- color: #6cb7f3;
|
|
|
|
|
- margin-left: 2px;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ color: $primary;
|
|
|
|
|
+ margin: 0 5px 0 -2px;
|
|
|
}
|
|
}
|
|
|
.num {
|
|
.num {
|
|
|
- background: #9dd0f9;
|
|
|
|
|
- width: 18px;
|
|
|
|
|
- height: 24px;
|
|
|
|
|
- margin-right: 2px;
|
|
|
|
|
- line-height: 24px;
|
|
|
|
|
|
|
+ background: $primary;
|
|
|
|
|
+ width: 15px;
|
|
|
|
|
+ height: 20px;
|
|
|
|
|
+ margin-right: 10px;
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
color: $white;
|
|
color: $white;
|
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
|
- border-radius: 2px;
|
|
|
|
|
- margin-top: 3px;
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|