|
@@ -3,37 +3,49 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
itemWidth: 150,
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
props: {
|
|
|
- dataList: Array
|
|
|
+ dataList: Array,
|
|
|
},
|
|
|
mounted() {
|
|
|
- let clientWidth = document.getElementsByClassName("coreData")[0].clientWidth;
|
|
|
- this.itemWidth = Math.floor(clientWidth/this.dataList.length)-40
|
|
|
- }
|
|
|
-}
|
|
|
+ let clientWidth =
|
|
|
+ document.getElementsByClassName("coreData")[0].clientWidth;
|
|
|
+ this.itemWidth = Math.floor(clientWidth / this.dataList.length) - 40;
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="coreData">
|
|
|
- <template v-for="(ele, index) in dataList" >
|
|
|
- <div class="coreData-item" :key="index" :style="{width: itemWidth+'px', backgroundColor: ele.isHighLight?'#e7f5fc':''}">
|
|
|
+ <template v-for="(ele, index) in dataList">
|
|
|
+ <div
|
|
|
+ class="coreData-item"
|
|
|
+ :key="index"
|
|
|
+ :style="{
|
|
|
+ width: itemWidth + 'px',
|
|
|
+ backgroundColor: ele.isHighLight ? '#e7f5fc' : '',
|
|
|
+ }"
|
|
|
+ >
|
|
|
<div class="coreData-item-title">{{ ele.title }}</div>
|
|
|
- <template v-if="ele.type===1">
|
|
|
-
|
|
|
- </template>
|
|
|
+ <template v-if="ele.type === 1"> </template>
|
|
|
<template v-else>
|
|
|
<div class="coreData-item-num">{{ ele.num }}</div>
|
|
|
- <div class="coreData-item-unit">{{ ele.unit }}</div>
|
|
|
+ <div class="coreData-item-unit" v-html="ele.unit"></div>
|
|
|
<div class="coreData-item-history">
|
|
|
<div class="coreData-item-historyDesc">
|
|
|
- <span v-if="ele.historyNum===0">{{ ele.historyDesc }}持平</span>
|
|
|
- <span v-else-if="ele.historyNum>0">{{ ele.historyDesc }}上升</span>
|
|
|
- <span v-else-if="ele.historyNum<0">{{ ele.historyDesc }}下降</span>
|
|
|
+ <span v-if="ele.historyNum === 0">{{ ele.historyDesc }}持平</span>
|
|
|
+ <span v-else-if="ele.historyNum > 0"
|
|
|
+ >{{ ele.historyDesc }}上升</span
|
|
|
+ >
|
|
|
+ <span v-else-if="ele.historyNum < 0"
|
|
|
+ >{{ ele.historyDesc }}下降</span
|
|
|
+ >
|
|
|
<span v-else></span>
|
|
|
</div>
|
|
|
- <div class="coreData-item-historyNum">{{ Math.abs(ele.historyNum) }}%</div>
|
|
|
+ <div class="coreData-item-historyNum" v-if="!isNaN(ele.historyNum)">
|
|
|
+ {{ Math.abs(ele.historyNum) }}%
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
@@ -44,13 +56,13 @@ export default {
|
|
|
<style lang="less" scoped>
|
|
|
.coreData {
|
|
|
width: 100%;
|
|
|
- height: 150px;
|
|
|
+ height: 140px;
|
|
|
.coreData-item {
|
|
|
display: inline-block;
|
|
|
vertical-align: top;
|
|
|
height: 120px;
|
|
|
margin: 10px;
|
|
|
- background-color: #F7FBFF;
|
|
|
+ background-color: #f7fbff;
|
|
|
padding: 8px 8px 8px 1.5%;
|
|
|
border-radius: 5px;
|
|
|
.coreData-item-title {
|