<!-- * @Description: 基本信息 * @Author: 王晓颖 * @Date: 2020-09-06 16:17:37 --> <template> <div class="index-container"> <!--左边图标--> <div class="index-left"> <slot></slot> </div> <!--右边内容--> <div class="index-right"> <!--标题--> <div class="index-name" :style="{'color':options.color}">{{data.name}}</div> <!--数值 & 单位--> <div class="index-data"> <div class="index-value" :style="{'color':options.color}">{{data.value}}</div> <div class="data-right"> {{data.unit}} </div> </div> </div> </div> </template> <script> export default { name: 'simpleBlock', props: { options: { type: Object, default: () => { return { bgColor: '', // 背景颜色, color: 'white' // 数值颜色 } } }, data: { type: Object, default: () => { return { name: '拥堵指数', // 标题 value: '341', // 数值 unit: '' } } } }, filters: { }, data () { return { } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> .index-container{ width:100%; height:100%; padding:0.05rem; display:flex; justify-content: space-between; align-items: center; .index-left{ /*width:2rem;*/ height:100%; width:0.3rem; display: flex; justify-content: center; align-items: center; img{ width:0.25rem; height:0.25rem; } } .index-right{ color:white; flex:1; .index-name{ color:white; font-size:0.08rem; font-weight: bold; margin-bottom: 0.03rem; } .index-data{ display: flex; justify-content: start; align-items: flex-end; .index-value{ font-size:0.18rem; font-weight: bolder; } .data-right{ display: flex; justify-content: start; font-size:0.07rem; margin-bottom: 0.02rem; } } } } </style>