You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.4 KiB

<template>
<view class="color-item" :class="size">
<div class="left-color" :style="{ background: item.leftColor }"></div>
<div class="rigth-color">
<div :style="{ background: item.rightTopColor }"></div>
<div class="rigth-bottom" v-show="item.color == 'HF' || item.color == 'NF'"></div>
</div>
<view v-show="showColorName" class="color-name">{{item.color}}</view>
</view>
</template>
<script>
export default {
name: "ColorItem",
props: {
showColorName: {
type: Boolean,
default: true,
},
size: {
type: String,
default: '',
},
item: {
type: Object,
default: () => {}
}
},
data() {
return {
};
}
}
</script>
<style lang="scss" scoped>
.color-item {
position: relative;
width: 80rpx;
height: 40rpx;
border: 2rpx solid #fff;
display: flex;
align-items: center;
.left-color,
.rigth-color {
flex: 1;
height: 100%;
}
.rigth-color {
display: flex;
flex-direction: column;
border-left: 2rpx solid #fff;
&>div {
flex: 1;
height: 100%;
}
.rigth-bottom {
background: red;
border-top: 2rpx solid #fff;
}
}
.color-name {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: -40rpx;
font-size: 28rpx;
}
}
.color-medium {
position: relative;
width: 120rpx;
height: 40rpx;
display: inline-block;
}
</style>