optmization

This commit is contained in:
jiaming 2018-12-12 18:46:49 +08:00
parent 6d321ffbc0
commit 8f0affe692
1 changed files with 14 additions and 2 deletions

View File

@ -15,11 +15,15 @@
</div> </div>
<div class="unit-label"> <div class="unit-label">
<div class="unit-container"> <div class="unit-container">
<div v-for="unit in unitData" :key="unit">{{ unit }}</div> <div v-for="(unit, index) in unitData" :key="unit + index">{{ unit }}</div>
</div> </div>
<div class="unit-text">单位</div> <div class="unit-text">单位</div>
</div> </div>
</div> </div>
<div class="for-solt">
<slot></slot>
</div>
</template> </template>
</div> </div>
</template> </template>
@ -56,7 +60,7 @@ export default {
const maxValue = Math.max(...capsuleData) const maxValue = Math.max(...capsuleData)
this.capsuleData = capsuleData.map(v => v / maxValue) this.capsuleData = capsuleData.map(v => maxValue ? v / maxValue : 0)
const oneSixth = maxValue / 5 const oneSixth = maxValue / 5
@ -134,5 +138,13 @@ export default {
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
} }
.for-solt {
position: absolute;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
}
} }
</style> </style>