add label line component

This commit is contained in:
jiaming 2018-12-20 18:25:34 +08:00
parent 5661b8d3ae
commit 4ea8a84ba4
1 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,41 @@
<template>
<div class="label-line">
<div class="label-item"
v-for="(labelItem, i) in label"
:key="labelItem">
<div :style="`background-color: ${colors[i % colors.length]};`"></div>
<div>{{ labelItem }}</div>
</div>
</div>
</template>
<script>
export default {
name: 'LabelLine',
props: ['label', 'colors']
}
</script>
<style lang="less">
.label-line {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
font-size: 10px;
.label-item {
height: 20px;
display: flex;
flex-direction: row;
align-items: center;
margin: 0px 5px 5px 5px;
:nth-child(1) {
width: 10px;
height: 10px;
margin-right: 5px;
}
}
}
</style>