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