<template>
  <div>
    <el-sub-menu :index="submenuData.path" class="subMenu">
      <template #title>
        <span class="item-title">{{ submenuData.meta?.title }}</span>
      </template>
      <template v-for="(item, index) in submenuData.children">
        <SubMenu v-if="item.meta?.type == 'subMenu'" :submenu="item"></SubMenu>
        <el-menu-item v-else class="item-title" :index="item.path">
          {{ item.meta.title }}
        </el-menu-item>
      </template>
    </el-sub-menu>
  </div>
</template>

<script setup>
import SubMenu from './subMenu.vue'

import { ref, watch, watchEffect } from 'vue'
const props = defineProps({
  submenuData: {
    type: Object,
    default: {},
  },
})
</script>

<style lang="scss" scoped>
.el-menu {
  .subMenu {
    :deep(div.el-sub-menu__title) {
      background-color:#30383e !important;
    }
  }
  .is-active {
    background-color: darken(#5584ff, 10%);
    :deep(div.el-sub-menu__title) {
      background-color: darken(#1d2429, 10%) !important;
    }
  }
}
</style>
