Giter Club home page Giter Club logo

Comments (4)

bhuh12 avatar bhuh12 commented on May 26, 2024

没能重现该错误,可以提供下重现问题的最简代码吗?方便定位

from vue-router-tab.

zhangyuepeng86 avatar zhangyuepeng86 commented on May 26, 2024

没能重现该错误,可以提供下重现问题的最简代码吗?方便定位

<template>
<el-container>
    <el-aside style="width: auto;">
      <aside></aside>
    </el-aside>
    <el-main>
      <el-container>
        <el-header><header></header></el-header>
        <el-main><main /></el-main>
      </el-container>
    </el-main>
  </el-container>
</template>
// main.js
<template>
  <div>
    <!-- <router-view v-if="this.$route.path"></router-view>
	<router-tab v-else/> -->
<router-tab></router-tab>
  </div>
</template>
//header.js
...
<el-dropdown-menu slot="dropdown" style="line-height: 13px;position:absolute;top: 40px ">
								<el-dropdown-item command="logout">注销登录</el-dropdown-item>
							</el-dropdown-menu>
...
logout () {
      this.$router.push({ name: 'login', path: '/login' })
}
// router.js
export default [{
    path: '/login',
    component: login,
    name: 'login'
  }, {
    path: '/logout',
    redirect: 'login'
  }, {
    path: '/',
    redirect: 'login'
  },
 {
  path: '/sys',
  component: MainLayout,
  name: 'sys',
  children: [{
    path: '/',
    component: main,
    children: [
      ...RouterTabRoutes,
      {
        path: '/',
        redirect: 'Function'
      },
      {
        path: 'Function',
        component: Function,
        name: 'Function',
        meta: {
          title: '功能管理', // 页签标题
          icon: 'el-icon-setting', // 页签图标,可选
          aliveId: 'fullPath', // 路由打开页签规则,可选
          tabClass: 'basicColor'
        }
      },
]
...
},
  {
    path: '*',
    redirect: '404'
  }
]

from vue-router-tab.

bhuh12 avatar bhuh12 commented on May 26, 2024

嵌套路由用错了,MainLayout 组件内部没有 router-view,是直接子组件引入 main 的,这不算嵌套路由

方案: component: main 这层路由删掉,children 直接提到上层

main 如果代码不复杂的话,没必要单独抽离组件,放 MainLayout 里面就可以。
而且 html5 也有 main 标签,用这个做组件名也不合适。

from vue-router-tab.

zhangyuepeng86 avatar zhangyuepeng86 commented on May 26, 2024

嵌套路由用错了,MainLayout 组件内部没有 router-view,是直接子组件引入 main 的,这不算嵌套路由

方案: component: main 这层路由删掉,children 直接提到上层

main 如果代码不复杂的话,没必要单独抽离组件,放 MainLayout 里面就可以。
而且 html5 也有 main 标签,用这个做组件名也不合适。

规划是mainlayout下有三种不同显示布局,所以又嵌套了一层router-view,去掉果然好了,谢谢指教

from vue-router-tab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.