<template>
  <div class="pressure-bars">
    <div v-for="item in list" :key="item.label" class="row">
      <div class="label">{{ item.label }}</div>
      <div class="bar">
        <div class="fill" :style="{ width: item.percent + '%' }"></div>
      </div>
      <div class="value">{{ item.value }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "PressureBars",
  props: {
    list: {
      type: Array,
      default() {
        return [
          { label: "次高压线", value: 120, percent: 80 },
          { label: "中压线", value: 98, percent: 60 },
          { label: "低压线", value: 86, percent: 40 },
        ];
      },
    },
  },
};
</script>

<style lang="scss" scoped>
.pressure-bars {
  width: 100%;
  background: #000;
  color: #fff;
  font-size: 14px;
}

.row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: rgba(120, 195, 255, 0.7);
}

.row + .row {
  margin-top: 8px;
}

.label {
  width: 70px;
  font-weight: 600;
}

.bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  margin: 0 12px;
  overflow: hidden;
}

.fill {
  height: 100%;
  background: linear-gradient(90deg, #00b7ff 0%, #20e0ff 100%);
  border-radius: 4px;
}

.value {
  width: 36px;
  text-align: right;
  font-weight: 600;
}
</style>
