Heisenberg_P 2020-04-09 13:05 采纳率: 0%
浏览 975

关于element-ui中router-view出现样式重叠的问题

图片说明
在vue项目中,利用router-view进行单页面后台系统时,在router-view中出现了
样式重叠的问题
以下是router配置

let routes = [
  {
    path: '/',
    component: App,
    children: [
      {path: '/index', component: index, name: '首页'},
      {path: '/city', component: city, name: '城市管理'},
      {path: '/site', component: site, name: '站点管理'},
      {path: '/route', component: route, name: '线路管理'}
    ]
  }
];

以下是app.vue中的使用

<el-row class="container" style="height: 100%">
    <v-header></v-header>
    <el-col :span="24" class="main">
      <el-row>
        <el-menu :default-active="$route.path" class="mar-l el-menu-vertical-demo el-col el-col-3" light router>
          <template v-for="(item,index) in $router.options.routes[0].children" v-if="!item.hidden">
            <el-menu-item :index="item.path" ><i class="fa" :class="item.class"></i>{{item.name}}</el-menu-item>
          </template>
        </el-menu>
        <section class="contentCon">
        <el-col :span="21" :offset="3" class="content-wrapper">
          <transition>
            <router-view></router-view>
          </transition>
        </el-col>
      </section>
      </el-row>
    </el-col>
  </el-row>
  • 写回答

1条回答 默认 最新

  • 关注

    <router-view></router-view>会默认请求this.$router.push("/"),导致了重叠  你可以在mounted() {
            this.$router.push("/XX")
        }给他一个空白页面

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算