用elementUI做的一个左侧菜单展示,直接上代码:
<template>
<div class="">
<!-- 一级菜单循环-->
<el-menu class="menuLen" v-for="( item1 ,index1 ) in menuList" :unique-opened=true :router=true :default-active="defaultActive" :key="index1" @open="handleOpen" @close="handleClose" :collapse="isCollapse">
<el-submenu :index='toSting(index1)' v-if="item1.permission">
<template slot="title">
<i :class="[item1.icon]" ></i>
<span slot="title">{
{ item1.name }}</span>
</template>
<!-- 二级菜单循环 -->
<div v-for="( item2 ,index2 ) in item1.childList" :key="index1+'-'+index2" >
<div v-if="item2.permission">
<el-submenu :index="toSting(index1,index2)">
<span slot="title">{
{ item2.name }}</span>
<!-- 三级菜单循环 -->
<div v-for="( item3 ,index3 ) in item2.childList" :key="index1+'-'+index2+'-'+index3">
<el-menu-item :index="item3.path">{
{ item3.name }}</el-menu-item>
</div>
</el-submenu>
</div>
<div