|
|
@ -1,19 +1,19 @@ |
|
|
|
<template> |
|
|
|
<div v-if="!item.hidden" class="menu-wrapper"> |
|
|
|
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow"> |
|
|
|
<!-- v-if="item.code && item.code === '0001'" --> |
|
|
|
<div @click="storageCode(item.code ? item.code : '')"> |
|
|
|
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)"> |
|
|
|
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}"> |
|
|
|
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" /> |
|
|
|
</el-menu-item> |
|
|
|
</app-link> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow && getShow(item.code)"> |
|
|
|
<!-- v-if="item.code && item.code === '0001'" --> |
|
|
|
<div @click="storageCode(item.code ? item.code : '')"> |
|
|
|
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)"> |
|
|
|
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}"> |
|
|
|
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" /> |
|
|
|
</el-menu-item> |
|
|
|
</app-link> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body> |
|
|
|
<el-submenu v-else-if="getShow(item.code)" ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body> |
|
|
|
<template slot="title"> |
|
|
|
<div @click="storageCode(item.code ? item.code : '')"> |
|
|
|
<div @click="storageCode(item.code ? item.code : '')"> |
|
|
|
<item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" /> |
|
|
|
</div> |
|
|
|
</template> |
|
|
@ -24,6 +24,7 @@ |
|
|
|
:item="child" |
|
|
|
:base-path="resolvePath(child.path)" |
|
|
|
class="nest-menu" |
|
|
|
:permission-list="permissionList" |
|
|
|
/> |
|
|
|
</el-submenu> |
|
|
|
|
|
|
@ -55,6 +56,10 @@ export default { |
|
|
|
basePath: { |
|
|
|
type: String, |
|
|
|
default: '' |
|
|
|
}, |
|
|
|
permissionList : { |
|
|
|
type: Array, |
|
|
|
default: () => [] |
|
|
|
} |
|
|
|
}, |
|
|
|
data() { |
|
|
@ -96,6 +101,15 @@ export default { |
|
|
|
}, |
|
|
|
storageCode(code){ |
|
|
|
localStorage.setItem('code', code) |
|
|
|
}, |
|
|
|
// 判断当前菜单是否显示 |
|
|
|
getShow(code) { |
|
|
|
const arr = [...this.permissionList] |
|
|
|
for(let i=0;i<arr.length;i++) { |
|
|
|
if(arr[i] === code) { |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// generateTitle |
|
|
|
} |
|
|
|