首页 > 其他 > 详细

elementUI三级路由

时间:2020-06-23 10:07:26      阅读:89      评论:0      收藏:0      [点我收藏+]
      <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>

 

elementUI三级路由

原文:https://www.cnblogs.com/wuqilang/p/13180095.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!