<template>
    <div class="legend-box">
      <div v-for="item in legendData" :key="item.color" class="legend-item">
        <span class="color-box" :style="{ background: item.color }"></span>
        <span>{{ item.range }}</span>
      </div>
    </div>
  </template>
  
  <script setup>
defineProps({
  legendData: Array,
});
</script>
  
  <style scoped>
.legend-box {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}
.color-box {
  width: 20px;
  height: 10px;
  margin-right: 6px;
  border: 1px solid #999;
}
</style>
  