elementUI三级路由


      <template v-for="item in sliders">
        <!-- 二级路由/三级路由 -->
        <template v-if="item.children&&item.children.length>0">
          <!-- 三级路由 -->
          <template v-if="item.children[0].children&&item.children[0].children.length>0">
            <el-submenu :index="item.path" :key="item.path">
              <template slot="title">
                <i :class="item.icon"></i>
                <span>{{item.text}}</span>
              </template>
              <el-submenu :index="child.path" v-for="(child,index) in item.children" :key="index">
                <template slot="title">
                  <i :class="child.icon"></i>
                  <span>{{child.text}}</span>
                </template>
                <el-menu-item
                  v-for="grandson in child.children"
                  :key="grandson.path"
                  :index="grandson.path"
                  @click="handlePush(grandson.path)"
                >
                  <span>{{grandson.text}}</span>
                </el-menu-item>
              </el-submenu>
            </el-submenu>
          </template>
          <!-- 二级路由 -->
          <template v-else>
            <el-submenu :index="item.path" :key="item.path">
              <template slot="title">
                <i :class="item.icon"></i>
                <span slot="title">{{item.text}}</span>
              </template>
              <el-menu-item
                v-for="child in item.children"
                :key="child.path"
                :index="child.path"
                @click="handlePush(child.path)"
              >
                <span>{{child.text}}</span>
              </el-menu-item>
            </el-submenu>
          </template>
        </template>
        <!-- 没有子标题 -->
        <el-menu-item :index="item.path" :key="item.path" v-else @click="handlePush(item.path)">
          <i :class="item.icon"></i>
          <span>{{item.text}}</span>
        </el-menu-item>
      </template>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM