toolList.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <div :class="['tool-list', 'tool-' + direction]">
  3. <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>
  4. </div>
  5. </template>
  6. <script setup>
  7. import {ref} from 'vue'
  8. const props = defineProps({
  9. direction: {
  10. type: String,
  11. defalut: "",
  12. },
  13. list: {
  14. type: Array,
  15. defalut: [],
  16. },
  17. });
  18. const active = ref(0)
  19. const handleActive = (value,index) =>{
  20. active.value = index
  21. }
  22. </script>
  23. <style lang="scss" scoped>
  24. .tool-list {
  25. width: 54px;
  26. height: 100%;
  27. background: #232323;
  28. border: 0.6px solid rgb(255, 255, 255, 0.4);
  29. box-sizing: border-box;
  30. border-radius: 4px;
  31. display: flex;
  32. flex-direction: column;
  33. justify-content: space-evenly;
  34. position: relative;
  35. &.tool-left {
  36. margin-right: 10px;
  37. border-left: none;
  38. }
  39. &.tool-right {
  40. margin-left: 10px;
  41. border-right: none;
  42. }
  43. .tool-item {
  44. font-size: 20px;
  45. writing-mode: vertical-rl; /* 从右到左的竖排 */
  46. text-orientation: upright; /* 保持文字直立,而不是旋转 */
  47. white-space: nowrap; /* 防止文本换行 */
  48. line-height: 54px;
  49. letter-spacing: 6px;
  50. color: #B9B9B9;
  51. font-family: "PangMenZhengDao";
  52. cursor: pointer;
  53. height: 100%;
  54. text-align: center;
  55. &.tool-item:first-child{
  56. border-radius: 4px 4px 0 0;
  57. }
  58. &.tool-item:last-child{
  59. border-radius: 0 0 4px 4px;
  60. }
  61. &.text{
  62. writing-mode:horizontal-tb;
  63. height: 40px;
  64. line-height: 40px;
  65. letter-spacing: 1px;
  66. width: 100%;
  67. text-align: center;
  68. font-size: 16px;
  69. }
  70. &.active{
  71. background: #101010;
  72. color: #2B85E4;
  73. }
  74. }
  75. }
  76. </style>