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>

 

posted @ 2020-06-23 06:57  吴小明-  阅读(1053)  评论(0编辑  收藏  举报