原因:共用了同一个<router-view></router-view>
解决方法:在二级路由处加一个router-view
component: {render(c) { return c('router-view') }},
image.png

<template>
  <div class="menu-wrapper">
    <el-menu
      :default-active="$route.path"
      background-color="#202736"
      text-color="#99A3AE"
      unique-opened
      active-text-color="#FFFFFF"
      :router="true"
      v-for="item in routerMenu"
      :key="item.path"
    >
      <!--需要下拉的菜单-->
      <template v-if="item.children">
        <el-submenu :index="item.path">
          <template slot="title">
            <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
          </template>
          <template v-for="subItem in item.children">
            <template v-if="subItem.children">
              <el-submenu :index="subItem.path">
                <template slot="title">
                  <item v-if="item.meta" :icon="subItem.meta && subItem.meta.icon" :title="subItem.meta.title" />
                </template>
                <template v-for="subItem2 in subItem.children">
                    <el-menu-item :index="subItem2.path" style="padding-left: 60px" v-if="subItem2.meta.showMenu">
                      <span slot="title" v-if="subItem2.meta.title">{{ subItem2.meta.title }}</span>
                    </el-menu-item>
                </template>
              </el-submenu>
            </template>
            <template v-else>
              <el-menu-item :index="subItem.path" style="padding-left: 40px">
                <span slot="title" v-if="subItem.meta.title">{{ subItem.meta.title }}</span>
              </el-menu-item>
            </template>
          </template>
        </el-submenu>
      </template>

      <!--直接点击菜单-->
      <template v-else>
        <el-menu-item :index="item.path" :class="{ 'submenu-title-noDropdown': !isNest }">
          <!--<span slot="title" class="menu-item-text" v-if="item.meta.title">{{item.meta.title}}</span>-->
          <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
        </el-menu-item>
      </template>
    </el-menu>
  </div>
</template>

李大树
58 声望4 粉丝

要是人生逻辑像代码逻辑一样。。。。。