Skip to content

Commit

Permalink
feat[menu]: add alwaysShow option
Browse files Browse the repository at this point in the history
  • Loading branch information
PanJiaChen committed Jan 24, 2018
1 parent 3b733bd commit 2c7586c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import Layout from '../views/layout/Layout'

/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true if set true, will always show the root menu, whatever its child routes length
* if not set alwaysShow, only more than one route under the children
* it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect if `redirect:noredirect` will no redirct in the breadcrumb
* name:'router-name' the name is used by <keep-alive> (must set!!!)
* meta : {
Expand Down
2 changes: 1 addition & 1 deletion src/views/layout/components/Sidebar/SidebarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="menu-wrapper">
<template v-for="item in routes" v-if="!item.hidden&&item.children">

<router-link v-if="item.children.length===1 && !item.children[0].children" :to="item.path+'/'+item.children[0].path" :key="item.children[0].name">
<router-link v-if="item.children.length===1 && !item.children[0].children && !item.alwaysShow" :to="item.path+'/'+item.children[0].path" :key="item.children[0].name">
<el-menu-item :index="item.path+'/'+item.children[0].path" :class="{'submenu-title-noDropdown':!isNest}">
<svg-icon v-if="item.children[0].meta&&item.children[0].meta.icon" :icon-class="item.children[0].meta.icon"></svg-icon>
<span v-if="item.children[0].meta&&item.children[0].meta.title">{{item.children[0].meta.title}}</span>
Expand Down

0 comments on commit 2c7586c

Please sign in to comment.