<!--
 * @Author: Liu_li
 * @Descripttion: 顶部菜单
 * @Date: 2021-09-26 11:03:50
-->
<template>
  <div>
    <el-menu :default-active="activeMenu" mode="horizontal" @select="handleSelect">
      <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
      </app-link>
    </el-menu>
  </div>
</template>

<script>
import path from 'path'
import { isExternal } from '@/utils/validate'
import Item from './Item'

export default {
  name: 'TopMenus',
  comments: { Item },
  props: {
    item: {
      type: Object,
      required: true
    }
  },
  data() {
    this.onlyOneChild = null
    return {
      activeIndex: '1',
      activeIndex2: '1'
    }
  },
  methods: {
    hasOneShowingChild(children = [], parent) {
      const showingChildren = children.filter(item => {
        this.onlyOneChild = item
        return true
      })
    }
  }
}
</script>
