index.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <script lang='ts' setup>
  2. defineProps({
  3. isOpen: {
  4. type: Boolean,
  5. default: false,
  6. },
  7. })
  8. const emit = defineEmits(['click'])
  9. const list = defineModel('list', {
  10. type: Array as PropType<any[]>,
  11. default: () => [],
  12. })
  13. const activeIndex = defineModel('activeIndex', {
  14. type: String,
  15. default: '',
  16. })
  17. function handleSelect(value: any) {
  18. activeIndex.value = value
  19. emit('click', value)
  20. }
  21. </script>
  22. <template>
  23. <div>
  24. <el-menu
  25. :unique-opened="true"
  26. :default-active="activeIndex"
  27. active-text-color="#CC9879"
  28. class="el-menu-banner-slider"
  29. @select="handleSelect"
  30. >
  31. <el-menu-item
  32. v-for="item, index in list" :key="index"
  33. :index="item.key"
  34. >
  35. {{ item.title }}
  36. </el-menu-item>
  37. </el-menu>
  38. </div>
  39. </template>
  40. <style lang='less' scoped>
  41. ::v-deep(.el-menu-banner-slider){
  42. // 继承
  43. background-color: inherit!important;
  44. .el-menu-item{
  45. margin-bottom: 30px;
  46. padding: 0!important;
  47. height: 16px!important;
  48. font-size: 16px!important;
  49. line-height: normal!important;
  50. color: #333;
  51. &:last-child{
  52. margin-bottom: 0;
  53. }
  54. }
  55. }
  56. </style>