Commit 5cff73bcafc27a36f111949d33f463dd2bb52571
1 parent
88de82c4
fix: fix the problem of collapsed display when the menu has no child nodes
Showing
2 changed files
with
32 additions
and
34 deletions
src/components/Menu/src/index.less
... | ... | @@ -248,14 +248,14 @@ |
248 | 248 | } |
249 | 249 | |
250 | 250 | &.ant-menu-inline-collapsed { |
251 | - .ant-menu-submenu-selected, | |
252 | 251 | .ant-menu-item-selected { |
253 | - .active-style(); | |
252 | + background: unset !important; | |
253 | + box-shadow: none; | |
254 | 254 | } |
255 | 255 | |
256 | + .ant-menu-submenu-selected, | |
256 | 257 | .ant-menu-item-selected { |
257 | - background: unset !important; | |
258 | - box-shadow: none; | |
258 | + .active-style(); | |
259 | 259 | } |
260 | 260 | } |
261 | 261 | } | ... | ... |
src/layouts/default/LayoutBreadcrumb.tsx
... | ... | @@ -46,11 +46,13 @@ export default defineComponent({ |
46 | 46 | if (homeRoute.name === firstItem.name) return false; |
47 | 47 | return homeRoute; |
48 | 48 | } |
49 | + | |
49 | 50 | function pathCompile(path: string) { |
50 | 51 | const { params } = unref(currentRoute); |
51 | 52 | const toPath = compile(path); |
52 | 53 | return toPath(params); |
53 | 54 | } |
55 | + | |
54 | 56 | function handleItemClick(item: AppRouteRecordRaw) { |
55 | 57 | const { redirect, path, meta } = item; |
56 | 58 | if (meta.disabledRedirect) return; |
... | ... | @@ -71,37 +73,33 @@ export default defineComponent({ |
71 | 73 | ); |
72 | 74 | |
73 | 75 | return () => ( |
74 | - <> | |
75 | - <Breadcrumb class="layout-breadcrumb"> | |
76 | - {() => ( | |
77 | - <> | |
78 | - <TransitionGroup name="breadcrumb"> | |
79 | - {() => { | |
80 | - return unref(itemList).map((item) => { | |
81 | - const isLink = !!item.redirect && !item.meta.disabledRedirect; | |
82 | - return ( | |
83 | - <BreadcrumbItem | |
84 | - key={item.path} | |
85 | - isLink={isLink} | |
86 | - onClick={handleItemClick.bind(null, item)} | |
87 | - > | |
88 | - {() => ( | |
89 | - <> | |
90 | - {props.showIcon && item.meta.icon && item.meta.icon.trim() !== '' && ( | |
91 | - <Icon icon={item.meta.icon} class="icon mr-1 mb-1" /> | |
92 | - )} | |
93 | - {item.meta.title} | |
94 | - </> | |
76 | + <Breadcrumb class="layout-breadcrumb"> | |
77 | + {() => ( | |
78 | + <TransitionGroup name="breadcrumb"> | |
79 | + {() => { | |
80 | + return unref(itemList).map((item) => { | |
81 | + const isLink = !!item.redirect && !item.meta.disabledRedirect; | |
82 | + return ( | |
83 | + <BreadcrumbItem | |
84 | + key={item.path} | |
85 | + isLink={isLink} | |
86 | + onClick={handleItemClick.bind(null, item)} | |
87 | + > | |
88 | + {() => ( | |
89 | + <> | |
90 | + {props.showIcon && item.meta.icon && item.meta.icon.trim() !== '' && ( | |
91 | + <Icon icon={item.meta.icon} class="icon mr-1 mb-1" /> | |
95 | 92 | )} |
96 | - </BreadcrumbItem> | |
97 | - ); | |
98 | - }); | |
99 | - }} | |
100 | - </TransitionGroup> | |
101 | - </> | |
102 | - )} | |
103 | - </Breadcrumb> | |
104 | - </> | |
93 | + {item.meta.title} | |
94 | + </> | |
95 | + )} | |
96 | + </BreadcrumbItem> | |
97 | + ); | |
98 | + }); | |
99 | + }} | |
100 | + </TransitionGroup> | |
101 | + )} | |
102 | + </Breadcrumb> | |
105 | 103 | ); |
106 | 104 | }, |
107 | 105 | }); | ... | ... |