<template>
  <div :class="['tool-list', 'tool-' + direction]">
    <div :class="['tool-item',{'text':item.name==='home'},{active:index===active}]" v-for="(item,index) in list" :key="index" @click="handleActive(item,index)">{{item.title}}</div>
  </div>
</template>

<script setup>
import {ref} from 'vue'
const props = defineProps({
  direction: {
    type: String,
    defalut: "",
  },
  list: {
    type: Array,
    defalut: [],
  },
});

const emit = defineEmits(['handleActive'])

const active = ref(0)
const handleActive = (value,index) =>{
    active.value = index
    emit('handleActive',value)
}
</script>

<style lang="scss" scoped>
.tool-list {
  width: 54px;
  height: 100%;
  background: #232323;
  border: 0.6px solid rgb(255, 255, 255, 0.4);
  box-sizing: border-box;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  position: relative;
  &.tool-left {
    margin-right: 10px;
    border-left: none;
  }
  &.tool-right {
    margin-left: 10px;
    border-right: none;
  }
  .tool-item {
    font-size: 20px;
    writing-mode: vertical-rl; /* 从右到左的竖排 */
    text-orientation: upright; /* 保持文字直立，而不是旋转 */
    white-space: nowrap; /* 防止文本换行 */
    line-height: 54px;
    letter-spacing: 6px;
    color: #B9B9B9;
    font-family: "PangMenZhengDao";
    cursor: pointer;
    height: 100%;
    text-align: center;
    &.tool-item:first-child{
        border-radius: 4px 4px 0 0;
    }
    &.tool-item:last-child{
        border-radius: 0 0 4px 4px;
    }
    &.text{
        writing-mode:horizontal-tb;
        height: 40px;
        line-height: 40px;
        letter-spacing: 1px;
        width: 100%;
        text-align: center;
        font-size: 16px;
    }
    &.active{
        background: #101010;
        color: #2B85E4;
    }
  }
}
</style>