<template>
  <div class="grade-sort-select-box">
    <el-select v-model="isSort" placeholder="评分排序" style="width: 130px" @change="handlePxChange">
      <template #prefix>
        <div style="display: flex; align-items: center; height: 100%">
          <img v-if="isSort" src="./down.svg" style="width: 16px; height: 16px" />
          <img v-else src="./up.svg" style="width: 16px; height: 16px" />
        </div>
      </template>
      <el-option v-for="item in gradeList" :key="item.value" :label="item.label" :value="item.value" />
    </el-select>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const isSort = ref(true)

const gradeList = ref([
  { label: "评分倒序", value: true },
  { label: "评分正序", value: false }
])

const emits = defineEmits(['handlePxChange'])

const handlePxChange = () => {
  emits('handlePxChange', isSort.value)
}

</script>

<style scoped>
.grade-sort-select-box {
  height: 42px;
  box-sizing: border-box;
  padding: 5px 0;
}
</style>