进行优化

This commit is contained in:
zouzhibing 2022-05-26 11:39:37 +08:00
parent 12e7c2fba2
commit 59a2e25de0
5 changed files with 14 additions and 6 deletions

View File

@ -1,6 +1,6 @@
<template>
<template v-if="!item.hidden">
<template v-if="hasOneShowingChild(item.children,item)">
<template v-if="!item.alwaysShow&&hasOneShowingChild(item.children,item)">
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
<el-menu-item :index="resolvePath(onlyOneChild.path)">
<el-icon :size="20">
@ -53,6 +53,7 @@ const hasOneShowingChild = (children = [], parent)=>{
return true
}
})
//
if (showingChildren.length === 1) {
return true

View File

@ -100,15 +100,12 @@
switch (key){
case 1:
logOut()
break;
case 2:
person.value.show()
break;
}
}
const handleCollapse = () => {
store.commit('app/SET_COLLAPSE', isCollapse.value)
}

View File

@ -17,6 +17,13 @@ interface extendRoute {
hidden?:boolean
}
/**
* alwaysShow true
* hidden hidden:truefalse
*
*/
export const constantRoutes: Array<RouteRecordRaw&extendRoute> = [
{
path: '/login',
@ -67,8 +74,10 @@ const clipboardTable = {
const zipRoutes = {
path: '/zip',
component: Layout,
isShow:true,
redirect: 'noRedirect',
name: 'zip',
alwaysShow:true,
meta: {
title: 'Zip',
icon: 'document-copy',

View File

@ -7,6 +7,7 @@ const permissionRouter = {
component: Layout,
redirect: 'noRedirect',
name: 'permission',
alwaysShow: true, // 总是显示根目录
meta: {
title: '权限测试页',
icon: 'trend-charts', roles:['other']

View File

@ -65,7 +65,7 @@
<script setup lang="ts">
import UUpload from '@/components/u-upload/index.vue'
import {ElMessage} from "element-plus";
import TwoPng from '@/assets/3.png'
import TwoPng from '@/assets/image/im1.jpeg'
import {reactive, ref} from 'vue'
const imgs = ref([{
url:TwoPng,
@ -137,4 +137,4 @@
display: inline-flex;
}
</style>
</style>