<template>
  <comOne class="com-menu" :title="menuItem.name" :url="menuItem.url">
    <div class="cm-subwraper" v-if="hasChild">
      <comSubmenu v-for="(item,index) in menuItem.children" :menuItem="item" :key="index"></comSubmenu>
    </div>
    <div class="cm-subwraper-nochild" v-else>
      暂无子组件
    </div>
  </comOne>
</template>
<script>
import comOne from './com-one'
import comSubmenu from './com-sub-menu'
export default {
  components: {
    comOne,
    comSubmenu
  },
  props: {
    menuItem: {
      default () {
        return {

        }
      }
    }
  },
  data () {
    return {

    }
  },
  computed: {
    hasChild () {
      return this.menuItem.children && this.menuItem.children.length
    }
  },
  created () {

  },
  mounted () {
    // console.log(this.menuItem)
  },
  methods: {

  }
}
</script>
<style lang="scss">

</style>
