33 lines
721 B
Vue
33 lines
721 B
Vue
<script setup>
|
|
const $props = defineProps({
|
|
colors: {
|
|
type: String,
|
|
default: '{"value": []}',
|
|
},
|
|
});
|
|
|
|
const colorArray = JSON.parse($props.colors)?.value;
|
|
const maxHeight = 30;
|
|
const colorHeight = maxHeight / colorArray?.length;
|
|
</script>
|
|
<template>
|
|
<div v-if="colors" class="color-div" :style="{ height: `${maxHeight}px` }">
|
|
<div
|
|
v-for="(color, index) in colorArray"
|
|
:key="index"
|
|
:style="{
|
|
backgroundColor: `#${color}`,
|
|
height: `${colorHeight}px`,
|
|
}"
|
|
>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<style scoped>
|
|
.color-div {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
</style>
|