-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(menu-list): 修复 左侧菜单全部展开后看不到全部菜单 #89 #99
Changes from all commits
725db25
c4d4348
1f66ac6
683d9f5
0a0130e
222f1c0
0e57e69
15469bd
d4adcf2
d0e5502
b5e453d
e27e39c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
<template> | ||
<a-menu | ||
v-model:openKeys="openKeys" | ||
v-model:selectedKeys="selectedKeys" | ||
mode="inline" theme="dark" | ||
:inline-collapsed="getCollapsed" | ||
> | ||
<template v-for="menu in menus" :key="menu.path"> | ||
<menu-item | ||
v-if="menu.meta?.single" | ||
:menu="menu" | ||
/> | ||
<menu-with-children | ||
v-else | ||
:current-depth="1" | ||
:parent-path="menu.path" | ||
:menu="menu" | ||
/> | ||
</template> | ||
</a-menu> | ||
<div> | ||
<a-menu | ||
v-model:openKeys="openKeys" | ||
v-model:selectedKeys="selectedKeys" | ||
:class="getMenuClass" | ||
mode="inline" theme="dark" | ||
:inline-collapsed="getCollapsed" | ||
> | ||
<template v-for="menu in menus" :key="menu.path"> | ||
<menu-item | ||
v-if="menu.meta?.single" | ||
:menu="menu" | ||
/> | ||
<menu-with-children | ||
v-else | ||
:current-depth="1" | ||
:parent-path="menu.path" | ||
:menu="menu" | ||
/> | ||
</template> | ||
</a-menu> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
import MenuWithChildren from './MenuWithChildren.vue' | ||
|
@@ -70,4 +73,33 @@ function getCurrentMenuRecursive(menus: RouteModuleList, targetKey: string, pare | |
} | ||
return keys | ||
} | ||
|
||
const getMenuClass = computed(() => { | ||
return ['menu-class', 'menu-class--fixed'] | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 没看明白这个 computed 存在的意义 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里是 参照 /src/layouts/default/sidebar/index.vue 的写法。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sidebar/index.vue 是想后面做扩展哈哈~ |
||
</script> | ||
|
||
<style scoped lang="less"> | ||
:deep(.menu-class) { | ||
&--fixed { | ||
height: calc(100vh - 56px); | ||
overflow-y: auto; | ||
} | ||
} | ||
|
||
/*定义整个滚动条高宽及背景:高宽分别对应横竖滚动条的尺寸*/ | ||
:deep(::-webkit-scrollbar) { | ||
width: 2px; | ||
height: 2px; | ||
background-color: #F5F5F5; | ||
} | ||
/*定义滚动条轨道:内阴影+圆角*/ | ||
:deep(::-webkit-scrollbar-track) { | ||
background-color: #F5F5F5; | ||
} | ||
/*定义滑块:内阴影+圆角*/ | ||
:deep(::-webkit-scrollbar-thumb) { | ||
border-radius: 2px; | ||
background-color: rgb(119, 119, 119); | ||
} | ||
</style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要用computed属性