NavMenu.vue 1.5 KB
Newer Older
小四是个处女座's avatar
小四是个处女座 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
<template>
  <div class="navMenu">
    <template v-for="navMenu in navMenus" >
        <!-- 最后一级菜单 -->
      <el-menu-item v-if="!navMenu.childs&&navMenu.entity" :key="navMenu.entity.id" :data="navMenu" :index="navMenu.entity.name">
        <!-- <i :class="navMenu.entity.icon"></i> -->
        <span slot="title" >{{navMenu.entity.alias}}</span>
      </el-menu-item>
      <!-- 此菜单下还有子菜单 -->
      <el-submenu v-if="navMenu.childs&&navMenu.entity"
                  :key="navMenu.entity.id" :data="navMenu" :index="navMenu.entity.name"> 
        <template slot="title">
           <!-- <i class="el-icon-remove-outline" v-if="activeIndex == navMenu.entity.name"></i> -->
          <i :class="navMenu.entity.icon" style="color:#ff4dff"></i>
         
          <span> {{navMenu.entity.alias}}</span>
          <!-- <span> 555{{navMenu.entity}}</span> -->
          <!-- <span> 88{{activeIndex}}</span> -->
        </template>
        <!-- 递归 -->
        <NavMenu :navMenus="navMenu.childs" id="childsId"></NavMenu>
      </el-submenu>
    </template>

  </div>
</template>

<script>
  export default {
    name: 'NavMenu',
    props: ['navMenus','activeIndex'],
    data() {
      return {}
    },
    mounted(){
      console.log(1089,this.activeIndex)
    },
    methods: {
     
    }
  }
</script>

<style scoped>
>>>.el-submenu .el-menu{
  margin-left: 30px !important
}
li{
  padding-left: 5px !important;
}

#childsId{
  border-left: 3px solid #33ff77  !important;
}
</style>