<template>
  <ul class="star_list apass_scroll">
    <li
      class="item_list"
      v-for="(option, index) in options"
      :key="'star_info_' + index"
    >
      <el-rate
        class="item-rate"
        :colors="['#8890a7', '#8890a7', '#8890a7']"
        :value="option.star"
        disabled
        disabled-void-color="transparent"
      >
      </el-rate>
      <el-progress
        class="item-progress"
        :percentage="getPercent(option.count)"
        :show-text="false"
        color="#e56600"
      ></el-progress>
      <span class="item-text" v-text="option.count + '个'"></span>
    </li>
  </ul>
</template>

<script>
export default {
  props: {
    options: {
      type: Array,
      default: () => [],
    },
    total: {
      type: Number,
      default: () => 10015,
    },
  },
  methods: {
    getPercent(value) {
      return Math.min((value / this.total) * 100, 100);
    },
  },
};
</script>

<style scoped>
.star_list {
  overflow-x: hidden;
  overflow-y: auto;
}
.item_list {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 12px;
}
.item-rate {
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-start;
  align-items: center;
  margin-right: 10px;
}
.item-progress {
  flex-grow: 1;
  max-width: 200px;
  margin-right: 10px;
}
.item-text {
  flex-shrink: 0;
  width: 60px;
  font-size: 14px;
  line-height: 20px;
  color: #242c43;
  text-align: right;
}
</style>

<style>
.item-rate .el-rate {
  height: 14px;
}
.item-rate .el-rate__icon {
  font-size: 14px;
  margin-right: 0;
}
.item-progress .el-progress-bar__outer {
  background: #e2e3ed;
}
</style>
