104 lines
2.1 KiB
Vue
104 lines
2.1 KiB
Vue
<template>
|
|
<view class="iots-component-box" :class="value.length>1?'':'oneFlex'">
|
|
<view class="attr-item-left">
|
|
<view class="iconfont" :class="icon"></view>
|
|
<view class="attr-name">{{name}}</view>
|
|
</view>
|
|
<view class="attr-item-right multi-line" v-if="value.length>1">
|
|
<view class="attr-value item-text" v-for="(item,index) in value" :key="index">
|
|
<view class="item-value">{{item.value}}<text style="margin-left: 6rpx;font-size: 24rpx;color: #aaa;">{{item.unit}}</text></view>
|
|
<view class="item-name">{{item.name}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="attr-item-right" v-else>
|
|
<view class="attr-value item-text">
|
|
<view>{{value[0].value}}<text style="margin-left: 6rpx;font-size: 24rpx;color: #aaa;">{{value[0].unit}}</text></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default{
|
|
name: 'iots-text',
|
|
props:{
|
|
// 选择值
|
|
value: {
|
|
type:[Array],
|
|
default:[{name:'',value:'',unit:''}]
|
|
},
|
|
// 图标处理后
|
|
icon: {
|
|
type: [String],
|
|
default: 'icon-gongnengdingyi'
|
|
},
|
|
name: {
|
|
type: [String],
|
|
default: ''
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
};
|
|
},
|
|
methods:{
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.iots-component-box{
|
|
padding: 20rpx 20rpx;
|
|
background: #fff;
|
|
margin-top: 20rpx;
|
|
border-radius: 10rpx;
|
|
&.oneFlex{
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
.attr-item-left{
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 28rpx;
|
|
color: #000;
|
|
.iconfont{
|
|
margin-right: 20rpx;
|
|
font-size: 40rpx;
|
|
}
|
|
}
|
|
.attr-item-right{
|
|
flex: 1;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
.attr-value{
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
height: 70rpx;
|
|
flex: 1;
|
|
}
|
|
&.multi-line{
|
|
padding: 20rpx 0;
|
|
justify-content: flex-start;
|
|
.attr-value{
|
|
width: 33%;
|
|
height: auto;
|
|
flex-direction: column;
|
|
flex: 0 1 auto;
|
|
.item-value{
|
|
font-weight: bold;
|
|
font-size: 40rpx;
|
|
}
|
|
.item-name{
|
|
font-size: 24rpx;
|
|
color: #aaa;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
</style> |