Commit 0ec1a62e596c363f3f017d6ac3b374a1b5caa7c5
1 parent
783e6581
fix(menu): top submenu disappeared problem #214
Showing
13 changed files
with
48 additions
and
352 deletions
CHANGELOG.zh_CN.md
build/config/lessModifyVars.ts
1 | /** | 1 | /** |
2 | * less global variable | 2 | * less global variable |
3 | */ | 3 | */ |
4 | -const primaryColor = '#018ffb'; | 4 | +const primaryColor = '#0084f4'; |
5 | +// const primaryColor = '#018ffb'; | ||
5 | // const primaryColor = '#0065cc'; | 6 | // const primaryColor = '#0065cc'; |
6 | //{ | 7 | //{ |
7 | const modifyVars = { | 8 | const modifyVars = { |
package.json
@@ -64,7 +64,7 @@ | @@ -64,7 +64,7 @@ | ||
64 | "@typescript-eslint/eslint-plugin": "^4.14.0", | 64 | "@typescript-eslint/eslint-plugin": "^4.14.0", |
65 | "@typescript-eslint/parser": "^4.14.0", | 65 | "@typescript-eslint/parser": "^4.14.0", |
66 | "@vitejs/plugin-legacy": "^1.2.1", | 66 | "@vitejs/plugin-legacy": "^1.2.1", |
67 | - "@vitejs/plugin-vue": "^1.1.2", | 67 | + "@vitejs/plugin-vue": "1.1.0", |
68 | "@vitejs/plugin-vue-jsx": "^1.0.2", | 68 | "@vitejs/plugin-vue-jsx": "^1.0.2", |
69 | "@vue/compiler-sfc": "^3.0.5", | 69 | "@vue/compiler-sfc": "^3.0.5", |
70 | "@vuedx/typecheck": "^0.6.0", | 70 | "@vuedx/typecheck": "^0.6.0", |
src/components/Menu/src/BasicMenu.vue
@@ -13,13 +13,7 @@ | @@ -13,13 +13,7 @@ | ||
13 | v-bind="getInlineCollapseOptions" | 13 | v-bind="getInlineCollapseOptions" |
14 | > | 14 | > |
15 | <template v-for="item in items" :key="item.path"> | 15 | <template v-for="item in items" :key="item.path"> |
16 | - <BasicSubMenuItem | ||
17 | - :item="item" | ||
18 | - :theme="theme" | ||
19 | - :level="1" | ||
20 | - :showTitle="showTitle" | ||
21 | - :isHorizontal="isHorizontal" | ||
22 | - /> | 16 | + <BasicSubMenuItem :item="item" :theme="theme" :isHorizontal="isHorizontal" /> |
23 | </template> | 17 | </template> |
24 | </Menu> | 18 | </Menu> |
25 | </template> | 19 | </template> |
@@ -46,6 +40,7 @@ | @@ -46,6 +40,7 @@ | ||
46 | 40 | ||
47 | // import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; | 41 | // import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; |
48 | import { listenerLastChangeTab } from '/@/logics/mitt/tabChange'; | 42 | import { listenerLastChangeTab } from '/@/logics/mitt/tabChange'; |
43 | + import { getAllParentPath } from '/@/router/helper/menuHelper'; | ||
49 | 44 | ||
50 | export default defineComponent({ | 45 | export default defineComponent({ |
51 | name: 'BasicMenu', | 46 | name: 'BasicMenu', |
@@ -96,16 +91,12 @@ | @@ -96,16 +91,12 @@ | ||
96 | prefixCls, | 91 | prefixCls, |
97 | `justify-${align}`, | 92 | `justify-${align}`, |
98 | { | 93 | { |
99 | - [`${prefixCls}--hide-title`]: !unref(showTitle), | ||
100 | - [`${prefixCls}--collapsed-show-title`]: props.collapsedShowTitle, | ||
101 | [`${prefixCls}__second`]: !props.isHorizontal && unref(getSplit), | 94 | [`${prefixCls}__second`]: !props.isHorizontal && unref(getSplit), |
102 | [`${prefixCls}__sidebar-hor`]: unref(getIsTopMenu), | 95 | [`${prefixCls}__sidebar-hor`]: unref(getIsTopMenu), |
103 | }, | 96 | }, |
104 | ]; | 97 | ]; |
105 | }); | 98 | }); |
106 | 99 | ||
107 | - const showTitle = computed(() => props.collapsedShowTitle && unref(getCollapsed)); | ||
108 | - | ||
109 | const getInlineCollapseOptions = computed(() => { | 100 | const getInlineCollapseOptions = computed(() => { |
110 | const isInline = props.mode === MenuModeEnum.INLINE; | 101 | const isInline = props.mode === MenuModeEnum.INLINE; |
111 | 102 | ||
@@ -135,7 +126,7 @@ | @@ -135,7 +126,7 @@ | ||
135 | } | 126 | } |
136 | ); | 127 | ); |
137 | 128 | ||
138 | - async function handleMenuClick({ key, keyPath }: { key: string; keyPath: string[] }) { | 129 | + async function handleMenuClick({ key }: { key: string; keyPath: string[] }) { |
139 | const { beforeClickFn } = props; | 130 | const { beforeClickFn } = props; |
140 | if (beforeClickFn && isFunction(beforeClickFn)) { | 131 | if (beforeClickFn && isFunction(beforeClickFn)) { |
141 | const flag = await beforeClickFn(key); | 132 | const flag = await beforeClickFn(key); |
@@ -144,7 +135,9 @@ | @@ -144,7 +135,9 @@ | ||
144 | emit('menuClick', key); | 135 | emit('menuClick', key); |
145 | 136 | ||
146 | isClickGo.value = true; | 137 | isClickGo.value = true; |
147 | - menuState.openKeys = keyPath; | 138 | + // const parentPath = await getCurrentParentPath(key); |
139 | + | ||
140 | + // menuState.openKeys = [parentPath]; | ||
148 | menuState.selectedKeys = [key]; | 141 | menuState.selectedKeys = [key]; |
149 | } | 142 | } |
150 | 143 | ||
@@ -160,7 +153,8 @@ | @@ -160,7 +153,8 @@ | ||
160 | const parentPath = await getCurrentParentPath(path); | 153 | const parentPath = await getCurrentParentPath(path); |
161 | menuState.selectedKeys = [parentPath]; | 154 | menuState.selectedKeys = [parentPath]; |
162 | } else { | 155 | } else { |
163 | - menuState.selectedKeys = [path]; | 156 | + const parentPaths = await getAllParentPath(props.items, path); |
157 | + menuState.selectedKeys = parentPaths; | ||
164 | } | 158 | } |
165 | } | 159 | } |
166 | 160 | ||
@@ -172,7 +166,6 @@ | @@ -172,7 +166,6 @@ | ||
172 | getMenuClass, | 166 | getMenuClass, |
173 | handleOpenChange, | 167 | handleOpenChange, |
174 | getOpenKeys, | 168 | getOpenKeys, |
175 | - showTitle, | ||
176 | ...toRefs(menuState), | 169 | ...toRefs(menuState), |
177 | }; | 170 | }; |
178 | }, | 171 | }, |
src/components/Menu/src/components/BasicMenuItem.vue
1 | <template> | 1 | <template> |
2 | - <MenuItem :class="getLevelClass"> | 2 | + <MenuItem> |
3 | + <!-- <MenuItem :class="getLevelClass"> --> | ||
3 | <MenuItemContent v-bind="$props" :item="item" /> | 4 | <MenuItemContent v-bind="$props" :item="item" /> |
4 | </MenuItem> | 5 | </MenuItem> |
5 | </template> | 6 | </template> |
6 | <script lang="ts"> | 7 | <script lang="ts"> |
7 | - import { defineComponent, computed } from 'vue'; | 8 | + import { defineComponent } from 'vue'; |
8 | import { Menu } from 'ant-design-vue'; | 9 | import { Menu } from 'ant-design-vue'; |
9 | import { useDesign } from '/@/hooks/web/useDesign'; | 10 | import { useDesign } from '/@/hooks/web/useDesign'; |
10 | import { itemProps } from '../props'; | 11 | import { itemProps } from '../props'; |
@@ -14,18 +15,19 @@ | @@ -14,18 +15,19 @@ | ||
14 | name: 'BasicMenuItem', | 15 | name: 'BasicMenuItem', |
15 | components: { MenuItem: Menu.Item, MenuItemContent }, | 16 | components: { MenuItem: Menu.Item, MenuItemContent }, |
16 | props: itemProps, | 17 | props: itemProps, |
17 | - setup(props) { | 18 | + setup() // props |
19 | + { | ||
18 | const { prefixCls } = useDesign('basic-menu-item'); | 20 | const { prefixCls } = useDesign('basic-menu-item'); |
19 | 21 | ||
20 | - const getLevelClass = computed(() => { | ||
21 | - const { level, theme } = props; | 22 | + // const getLevelClass = computed(() => { |
23 | + // const { level, theme } = props; | ||
22 | 24 | ||
23 | - const levelCls = [`${prefixCls}__level${level}`, theme]; | ||
24 | - return levelCls; | ||
25 | - }); | 25 | + // const levelCls = [`${prefixCls}__level${level}`, theme]; |
26 | + // return levelCls; | ||
27 | + // }); | ||
26 | return { | 28 | return { |
27 | prefixCls, | 29 | prefixCls, |
28 | - getLevelClass, | 30 | + // getLevelClass, |
29 | }; | 31 | }; |
30 | }, | 32 | }, |
31 | }); | 33 | }); |
src/components/Menu/src/components/BasicSubMenuItem.vue
@@ -2,17 +2,15 @@ | @@ -2,17 +2,15 @@ | ||
2 | <BasicMenuItem v-if="!menuHasChildren(item) && getShowMenu" v-bind="$props" /> | 2 | <BasicMenuItem v-if="!menuHasChildren(item) && getShowMenu" v-bind="$props" /> |
3 | <SubMenu | 3 | <SubMenu |
4 | v-if="menuHasChildren(item) && getShowMenu" | 4 | v-if="menuHasChildren(item) && getShowMenu" |
5 | - :class="[`${prefixCls}__level${level}`, theme]" | 5 | + :class="[theme]" |
6 | + popupClassName="app-top-menu-popup" | ||
6 | > | 7 | > |
7 | <template #title> | 8 | <template #title> |
8 | <MenuItemContent v-bind="$props" :item="item" /> | 9 | <MenuItemContent v-bind="$props" :item="item" /> |
9 | </template> | 10 | </template> |
10 | - <!-- <template #expandIcon="{ key }"> | ||
11 | - <ExpandIcon :key="key" /> | ||
12 | - </template> --> | ||
13 | 11 | ||
14 | <template v-for="childrenItem in item.children || []" :key="childrenItem.path"> | 12 | <template v-for="childrenItem in item.children || []" :key="childrenItem.path"> |
15 | - <BasicSubMenuItem v-bind="$props" :item="childrenItem" :level="level + 1" /> | 13 | + <BasicSubMenuItem v-bind="$props" :item="childrenItem" /> |
16 | </template> | 14 | </template> |
17 | </SubMenu> | 15 | </SubMenu> |
18 | </template> | 16 | </template> |
@@ -26,7 +24,6 @@ | @@ -26,7 +24,6 @@ | ||
26 | import BasicMenuItem from './BasicMenuItem.vue'; | 24 | import BasicMenuItem from './BasicMenuItem.vue'; |
27 | import MenuItemContent from './MenuItemContent.vue'; | 25 | import MenuItemContent from './MenuItemContent.vue'; |
28 | 26 | ||
29 | - // import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; | ||
30 | export default defineComponent({ | 27 | export default defineComponent({ |
31 | name: 'BasicSubMenuItem', | 28 | name: 'BasicSubMenuItem', |
32 | isSubMenu: true, | 29 | isSubMenu: true, |
@@ -35,7 +32,6 @@ | @@ -35,7 +32,6 @@ | ||
35 | SubMenu: Menu.SubMenu, | 32 | SubMenu: Menu.SubMenu, |
36 | MenuItem: Menu.Item, | 33 | MenuItem: Menu.Item, |
37 | MenuItemContent, | 34 | MenuItemContent, |
38 | - // ExpandIcon: createAsyncComponent(() => import('./ExpandIcon.vue')), | ||
39 | }, | 35 | }, |
40 | props: itemProps, | 36 | props: itemProps, |
41 | setup(props) { | 37 | setup(props) { |
src/components/Menu/src/components/MenuItemContent.vue
1 | <template> | 1 | <template> |
2 | <span :class="`${prefixCls}-wrapper`"> | 2 | <span :class="`${prefixCls}-wrapper`"> |
3 | <Icon v-if="getIcon" :icon="getIcon" :size="18" :class="`${prefixCls}-wrapper__icon`" /> | 3 | <Icon v-if="getIcon" :icon="getIcon" :size="18" :class="`${prefixCls}-wrapper__icon`" /> |
4 | - <span :class="getNameClass"> | ||
5 | - {{ getI18nName }} | ||
6 | - <MenuItemTag v-bind="$props" /> | ||
7 | - </span> | 4 | + {{ getI18nName }} |
8 | </span> | 5 | </span> |
9 | </template> | 6 | </template> |
10 | <script lang="ts"> | 7 | <script lang="ts"> |
@@ -14,25 +11,21 @@ | @@ -14,25 +11,21 @@ | ||
14 | import { useI18n } from '/@/hooks/web/useI18n'; | 11 | import { useI18n } from '/@/hooks/web/useI18n'; |
15 | import { useDesign } from '/@/hooks/web/useDesign'; | 12 | import { useDesign } from '/@/hooks/web/useDesign'; |
16 | import { contentProps } from '../props'; | 13 | import { contentProps } from '../props'; |
17 | - import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; | ||
18 | const { t } = useI18n(); | 14 | const { t } = useI18n(); |
19 | 15 | ||
20 | export default defineComponent({ | 16 | export default defineComponent({ |
21 | name: 'MenuItemContent', | 17 | name: 'MenuItemContent', |
22 | - components: { Icon, MenuItemTag: createAsyncComponent(() => import('./MenuItemTag.vue')) }, | 18 | + components: { |
19 | + Icon, | ||
20 | + }, | ||
23 | props: contentProps, | 21 | props: contentProps, |
24 | setup(props) { | 22 | setup(props) { |
25 | const { prefixCls } = useDesign('basic-menu-item-content'); | 23 | const { prefixCls } = useDesign('basic-menu-item-content'); |
26 | const getI18nName = computed(() => t(props.item?.name)); | 24 | const getI18nName = computed(() => t(props.item?.name)); |
27 | const getIcon = computed(() => props.item?.icon); | 25 | const getIcon = computed(() => props.item?.icon); |
28 | 26 | ||
29 | - const getNameClass = computed(() => { | ||
30 | - const { showTitle } = props; | ||
31 | - return { [`${prefixCls}--show-title`]: showTitle, [`${prefixCls}__name`]: !showTitle }; | ||
32 | - }); | ||
33 | return { | 27 | return { |
34 | prefixCls, | 28 | prefixCls, |
35 | - getNameClass, | ||
36 | getI18nName, | 29 | getI18nName, |
37 | getIcon, | 30 | getIcon, |
38 | }; | 31 | }; |
src/components/Menu/src/index.less
1 | @basic-menu-prefix-cls: ~'@{namespace}-basic-menu'; | 1 | @basic-menu-prefix-cls: ~'@{namespace}-basic-menu'; |
2 | -@basic-menu-content-prefix-cls: ~'@{namespace}-basic-menu-item-content'; | ||
3 | -@basic-menu-tag-prefix-cls: ~'@{namespace}-basic-menu-item-tag'; | ||
4 | 2 | ||
5 | -.active-style() { | ||
6 | - color: @white; | ||
7 | - // background: @primary-color !important; | ||
8 | - background: linear-gradient( | ||
9 | - 118deg, | ||
10 | - rgba(@primary-color, 0.8), | ||
11 | - rgba(@primary-color, 1) | ||
12 | - ) !important; | ||
13 | -} | ||
14 | - | ||
15 | -.active-menu-style() { | ||
16 | - .ant-menu-item-selected, | ||
17 | - .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected { | ||
18 | - .active-style(); | ||
19 | - } | 3 | +.app-top-menu-popup { |
4 | + min-width: 150px; | ||
20 | } | 5 | } |
21 | 6 | ||
22 | .@{basic-menu-prefix-cls} { | 7 | .@{basic-menu-prefix-cls} { |
23 | width: 100%; | 8 | width: 100%; |
24 | 9 | ||
25 | - // &__expand-icon { | ||
26 | - // position: absolute; | ||
27 | - // top: calc(50% - 6px); | ||
28 | - // right: 16px; | ||
29 | - // width: 10px; | ||
30 | - // transform-origin: none; | ||
31 | - // opacity: 0.45; | ||
32 | - | ||
33 | - // span[role='img'] { | ||
34 | - // margin-right: 0; | ||
35 | - // font-size: 11px; | ||
36 | - // } | ||
37 | - | ||
38 | - // &--collapsed { | ||
39 | - // opacity: 0; | ||
40 | - // } | ||
41 | - // } | ||
42 | - | ||
43 | - // collapsed show title start | ||
44 | - .@{basic-menu-content-prefix-cls}--show-title { | ||
45 | - max-width: unset !important; | ||
46 | - opacity: 1 !important; | ||
47 | - } | ||
48 | - | ||
49 | - &--hide-title { | ||
50 | - &.ant-menu-inline-collapsed > .ant-menu-item, | ||
51 | - &.ant-menu-inline-collapsed > .ant-menu-item-group > .ant-menu-item-group-list > .ant-menu-item, | ||
52 | - &.ant-menu-inline-collapsed | ||
53 | - > .ant-menu-item-group | ||
54 | - > .ant-menu-item-group-list | ||
55 | - > .ant-menu-submenu | ||
56 | - > .ant-menu-submenu-title, | ||
57 | - &.ant-menu-inline-collapsed .ant-menu-submenu-title { | ||
58 | - padding-right: 16px !important; | ||
59 | - padding-left: 16px !important; | ||
60 | - } | ||
61 | - } | ||
62 | - | ||
63 | - &--collapsed-show-title.ant-menu-inline-collapsed { | ||
64 | - .@{basic-menu-prefix-cls}-item__level1 { | ||
65 | - padding: 2px 0; | ||
66 | - justify-content: center !important; | ||
67 | - | ||
68 | - &.ant-menu-item { | ||
69 | - display: flex; | ||
70 | - align-items: center; | ||
71 | - height: 60px !important; | ||
72 | - margin-top: 0 !important; | ||
73 | - margin-bottom: 0 !important; | ||
74 | - line-height: 60px !important; | ||
75 | - | ||
76 | - > span { | ||
77 | - margin-top: 10px; | ||
78 | - } | ||
79 | - } | ||
80 | - } | ||
81 | - | ||
82 | - & > li[role='menuitem']:not(.ant-menu-submenu), | ||
83 | - & > li > .ant-menu-submenu-title { | ||
84 | - display: flex; | ||
85 | - margin-top: 10px; | ||
86 | - font-size: 12px; | ||
87 | - flex-direction: column; | ||
88 | - align-items: center; | ||
89 | - line-height: 24px; | ||
90 | - } | ||
91 | - | ||
92 | - & > li > .ant-menu-submenu-title { | ||
93 | - line-height: 24px; | ||
94 | - } | ||
95 | - .@{basic-menu-content-prefix-cls}-wrapper { | ||
96 | - display: flex; | ||
97 | - justify-content: center; | ||
98 | - align-items: center; | ||
99 | - flex-direction: column; | ||
100 | - .@{basic-menu-content-prefix-cls}--show-title { | ||
101 | - line-height: 30px; | ||
102 | - } | ||
103 | - } | ||
104 | - } | ||
105 | - | ||
106 | - &.ant-menu-inline-collapsed > .ant-menu-item, | ||
107 | - &.ant-menu-inline-collapsed > .ant-menu-item-group > .ant-menu-item-group-list > .ant-menu-item, | ||
108 | - &.ant-menu-inline-collapsed | ||
109 | - > .ant-menu-item-group | ||
110 | - > .ant-menu-item-group-list | ||
111 | - > .ant-menu-submenu | ||
112 | - > .ant-menu-submenu-title, | ||
113 | - &.ant-menu-inline-collapsed .ant-menu-submenu-title { | ||
114 | - padding-right: 16px !important; | ||
115 | - padding-left: 16px !important; | ||
116 | - } | ||
117 | - | ||
118 | - .@{basic-menu-content-prefix-cls}-wrapper { | ||
119 | - width: 100%; | ||
120 | - margin-top: 4px; | ||
121 | - | ||
122 | - &__icon { | ||
123 | - vertical-align: text-top; | ||
124 | - } | ||
125 | - } | ||
126 | - | ||
127 | .ant-menu-item { | 10 | .ant-menu-item { |
128 | transition: unset; | 11 | transition: unset; |
129 | } | 12 | } |
@@ -179,117 +62,6 @@ | @@ -179,117 +62,6 @@ | ||
179 | } | 62 | } |
180 | } | 63 | } |
181 | 64 | ||
182 | - &.ant-menu-dark:not(.@{basic-menu-prefix-cls}__sidebar-hor):not(.@{basic-menu-prefix-cls}__second) { | ||
183 | - // Reset menu item row height | ||
184 | - .ant-menu-item:not(.@{basic-menu-prefix-cls}-item__level1), | ||
185 | - .ant-menu-sub.ant-menu-inline > .ant-menu-item, | ||
186 | - .ant-menu-sub.ant-menu-inline > .ant-menu-submenu > .ant-menu-submenu-title { | ||
187 | - height: @app-menu-item-height; | ||
188 | - margin: 0; | ||
189 | - line-height: @app-menu-item-height; | ||
190 | - } | ||
191 | - | ||
192 | - .ant-menu-item.@{basic-menu-prefix-cls}-item__level1 { | ||
193 | - height: @app-menu-item-height; | ||
194 | - line-height: @app-menu-item-height; | ||
195 | - } | ||
196 | - } | ||
197 | - | ||
198 | - // 层级样式 | ||
199 | - &.ant-menu-dark:not(.@{basic-menu-prefix-cls}__sidebar-hor) { | ||
200 | - overflow: hidden; | ||
201 | - background: @sider-dark-bg-color; | ||
202 | - .active-menu-style(); | ||
203 | - | ||
204 | - .ant-menu-item.ant-menu-item-selected.@{basic-menu-prefix-cls}-menu-item__level1, | ||
205 | - .ant-menu-submenu-selected.@{basic-menu-prefix-cls}-menu-item__level1 { | ||
206 | - color: @white; | ||
207 | - } | ||
208 | - | ||
209 | - .@{basic-menu-prefix-cls}-item__level1 { | ||
210 | - background-color: @sider-dark-bg-color; | ||
211 | - | ||
212 | - > .ant-menu-sub > li { | ||
213 | - background-color: @sider-dark-lighten-1-bg-color; | ||
214 | - } | ||
215 | - } | ||
216 | - | ||
217 | - .@{basic-menu-prefix-cls}-item__level2:not(.ant-menu-item-selected), | ||
218 | - .ant-menu-sub { | ||
219 | - background-color: @sider-dark-lighten-1-bg-color; | ||
220 | - } | ||
221 | - | ||
222 | - .@{basic-menu-prefix-cls}-item__level3:not(.ant-menu-item-selected) { | ||
223 | - background-color: @sider-dark-lighten-2-bg-color; | ||
224 | - | ||
225 | - .ant-menu-item { | ||
226 | - background-color: @sider-dark-lighten-2-bg-color; | ||
227 | - } | ||
228 | - } | ||
229 | - | ||
230 | - .ant-menu-submenu-title { | ||
231 | - display: flex; | ||
232 | - height: @app-menu-item-height; | ||
233 | - // margin: 0; | ||
234 | - align-items: center; | ||
235 | - } | ||
236 | - | ||
237 | - &.ant-menu-inline-collapsed { | ||
238 | - .ant-menu-submenu-selected, | ||
239 | - .ant-menu-item-selected { | ||
240 | - position: relative; | ||
241 | - font-weight: 500; | ||
242 | - color: @white; | ||
243 | - background: @sider-dark-darken-bg-color !important; | ||
244 | - | ||
245 | - &::before { | ||
246 | - position: absolute; | ||
247 | - top: 0; | ||
248 | - left: 0; | ||
249 | - width: 3px; | ||
250 | - height: 100%; | ||
251 | - background: @primary-color; | ||
252 | - content: ''; | ||
253 | - } | ||
254 | - } | ||
255 | - } | ||
256 | - } | ||
257 | - | ||
258 | - &.ant-menu-light:not(.@{basic-menu-prefix-cls}__sidebar-hor) { | ||
259 | - // overflow: hidden; | ||
260 | - border-right: none; | ||
261 | - | ||
262 | - .ant-menu-item.ant-menu-item-selected.@{basic-menu-prefix-cls}-menu-item__level1, | ||
263 | - .ant-menu-submenu-selected.@{basic-menu-prefix-cls}-menu-item__level1 { | ||
264 | - color: @primary-color; | ||
265 | - } | ||
266 | - } | ||
267 | - | ||
268 | - &.@{basic-menu-prefix-cls}__second.ant-menu-inline-collapsed:not(.@{basic-menu-prefix-cls}__sidebar-hor) { | ||
269 | - // Reset menu item row height | ||
270 | - .@{basic-menu-prefix-cls}-item__level1 { | ||
271 | - display: flex; | ||
272 | - height: @app-menu-item-height * 1.4; | ||
273 | - padding: 6px 0 !important; | ||
274 | - margin: 0; | ||
275 | - font-size: 12px; | ||
276 | - line-height: @app-menu-item-height; | ||
277 | - align-items: center; | ||
278 | - text-align: center; | ||
279 | - | ||
280 | - > div { | ||
281 | - padding: 6px 0 !important; | ||
282 | - font-size: 12px; | ||
283 | - } | ||
284 | - | ||
285 | - .@{basic-menu-content-prefix-cls}__name { | ||
286 | - display: inline-block; | ||
287 | - width: 50%; | ||
288 | - overflow: hidden; | ||
289 | - } | ||
290 | - } | ||
291 | - } | ||
292 | - | ||
293 | .ant-menu-submenu, | 65 | .ant-menu-submenu, |
294 | .ant-menu-submenu-inline { | 66 | .ant-menu-submenu-inline { |
295 | transition: unset; | 67 | transition: unset; |
@@ -300,63 +72,3 @@ | @@ -300,63 +72,3 @@ | ||
300 | transition: unset; | 72 | transition: unset; |
301 | } | 73 | } |
302 | } | 74 | } |
303 | - | ||
304 | -.ant-menu-dark { | ||
305 | - &.ant-menu-submenu-popup { | ||
306 | - > ul { | ||
307 | - background: @sider-dark-bg-color; | ||
308 | - } | ||
309 | - .active-menu-style(); | ||
310 | - } | ||
311 | -} | ||
312 | - | ||
313 | -// collapsed show title end | ||
314 | -.ant-menu-item, | ||
315 | -.ant-menu-submenu-title { | ||
316 | - > .@{basic-menu-content-prefix-cls}__name { | ||
317 | - width: 100%; | ||
318 | - | ||
319 | - .@{basic-menu-tag-prefix-cls} { | ||
320 | - float: right; | ||
321 | - margin-top: @app-menu-item-height / 2; | ||
322 | - transform: translate(0%, -50%); | ||
323 | - } | ||
324 | - } | ||
325 | -} | ||
326 | - | ||
327 | -.@{basic-menu-tag-prefix-cls} { | ||
328 | - position: absolute; | ||
329 | - top: calc(50% - 8px); | ||
330 | - right: 30px; | ||
331 | - display: inline-block; | ||
332 | - padding: 2px 4px; | ||
333 | - margin-right: 4px; | ||
334 | - font-size: 12px; | ||
335 | - line-height: 14px; | ||
336 | - color: #fff; | ||
337 | - border-radius: 2px; | ||
338 | - | ||
339 | - &--dot { | ||
340 | - top: calc(50% - 4px); | ||
341 | - width: 6px; | ||
342 | - height: 6px; | ||
343 | - padding: 0; | ||
344 | - border-radius: 50%; | ||
345 | - } | ||
346 | - | ||
347 | - &--primary { | ||
348 | - background: @primary-color; | ||
349 | - } | ||
350 | - | ||
351 | - &--error { | ||
352 | - background: @error-color; | ||
353 | - } | ||
354 | - | ||
355 | - &--success { | ||
356 | - background: @success-color; | ||
357 | - } | ||
358 | - | ||
359 | - &--warn { | ||
360 | - background: @warning-color; | ||
361 | - } | ||
362 | -} |
src/layouts/default/menu/useLayoutMenu.ts
@@ -72,9 +72,6 @@ export function useSplitMenu(splitType: Ref<MenuSplitTyeEnum>) { | @@ -72,9 +72,6 @@ export function useSplitMenu(splitType: Ref<MenuSplitTyeEnum>) { | ||
72 | 72 | ||
73 | // Handle left menu split | 73 | // Handle left menu split |
74 | async function handleSplitLeftMenu(parentPath: string) { | 74 | async function handleSplitLeftMenu(parentPath: string) { |
75 | - console.log('======================'); | ||
76 | - console.log(unref(getSplitLeft)); | ||
77 | - console.log('======================'); | ||
78 | if (unref(getSplitLeft) || unref(getIsMobile)) return; | 75 | if (unref(getSplitLeft) || unref(getIsMobile)) return; |
79 | 76 | ||
80 | // spilt mode left | 77 | // spilt mode left |
src/layouts/page/ParentView.vue
@@ -19,9 +19,9 @@ | @@ -19,9 +19,9 @@ | ||
19 | appear | 19 | appear |
20 | > | 20 | > |
21 | <keep-alive v-if="openCache" :include="getCaches"> | 21 | <keep-alive v-if="openCache" :include="getCaches"> |
22 | - <component :is="Component" :key="route.fullPath" /> | 22 | + <component :is="Component" v-bind="getKey(Component, route)" /> |
23 | </keep-alive> | 23 | </keep-alive> |
24 | - <component v-else :is="Component" :key="route.fullPath" /> | 24 | + <component v-else :is="Component" v-bind="getKey(Component, route)" /> |
25 | </transition> | 25 | </transition> |
26 | </template> | 26 | </template> |
27 | </router-view> | 27 | </router-view> |
@@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
34 | import { useMultipleTabSetting } from '/@/hooks/setting/useMultipleTabSetting'; | 34 | import { useMultipleTabSetting } from '/@/hooks/setting/useMultipleTabSetting'; |
35 | 35 | ||
36 | import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting'; | 36 | import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting'; |
37 | - import { useCache } from './useCache'; | 37 | + import { useCache, getKey } from './useCache'; |
38 | import { getTransitionName } from './transition'; | 38 | import { getTransitionName } from './transition'; |
39 | 39 | ||
40 | export default defineComponent({ | 40 | export default defineComponent({ |
@@ -56,6 +56,7 @@ | @@ -56,6 +56,7 @@ | ||
56 | openCache, | 56 | openCache, |
57 | getEnableTransition, | 57 | getEnableTransition, |
58 | getTransitionName, | 58 | getTransitionName, |
59 | + getKey, | ||
59 | }; | 60 | }; |
60 | }, | 61 | }, |
61 | }); | 62 | }); |
src/layouts/page/index.vue
@@ -27,9 +27,6 @@ | @@ -27,9 +27,6 @@ | ||
27 | </template> | 27 | </template> |
28 | 28 | ||
29 | <script lang="ts"> | 29 | <script lang="ts"> |
30 | - import type { FunctionalComponent } from 'vue'; | ||
31 | - import type { RouteLocation } from 'vue-router'; | ||
32 | - | ||
33 | import { computed, defineComponent, unref } from 'vue'; | 30 | import { computed, defineComponent, unref } from 'vue'; |
34 | 31 | ||
35 | import FrameLayout from '/@/layouts/iframe/index.vue'; | 32 | import FrameLayout from '/@/layouts/iframe/index.vue'; |
@@ -37,7 +34,7 @@ | @@ -37,7 +34,7 @@ | ||
37 | import { useRootSetting } from '/@/hooks/setting/useRootSetting'; | 34 | import { useRootSetting } from '/@/hooks/setting/useRootSetting'; |
38 | 35 | ||
39 | import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting'; | 36 | import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting'; |
40 | - import { useCache } from './useCache'; | 37 | + import { useCache, getKey } from './useCache'; |
41 | import { useMultipleTabSetting } from '/@/hooks/setting/useMultipleTabSetting'; | 38 | import { useMultipleTabSetting } from '/@/hooks/setting/useMultipleTabSetting'; |
42 | import { getTransitionName } from './transition'; | 39 | import { getTransitionName } from './transition'; |
43 | 40 | ||
@@ -54,10 +51,6 @@ | @@ -54,10 +51,6 @@ | ||
54 | 51 | ||
55 | const openCache = computed(() => unref(getOpenKeepAlive) && unref(getShowMultipleTab)); | 52 | const openCache = computed(() => unref(getOpenKeepAlive) && unref(getShowMultipleTab)); |
56 | 53 | ||
57 | - function getKey(component: FunctionalComponent & { type: Indexable }, route: RouteLocation) { | ||
58 | - return !!component?.type.parentView ? {} : { key: route.fullPath }; | ||
59 | - } | ||
60 | - | ||
61 | return { | 54 | return { |
62 | getTransitionName, | 55 | getTransitionName, |
63 | openCache, | 56 | openCache, |
src/layouts/page/useCache.ts
1 | +import type { FunctionalComponent } from 'vue'; | ||
2 | +import type { RouteLocation } from 'vue-router'; | ||
1 | import { computed, ref, unref } from 'vue'; | 3 | import { computed, ref, unref } from 'vue'; |
2 | import { useRootSetting } from '/@/hooks/setting/useRootSetting'; | 4 | import { useRootSetting } from '/@/hooks/setting/useRootSetting'; |
3 | import { tryTsxEmit } from '/@/utils/helper/vueHelper'; | 5 | import { tryTsxEmit } from '/@/utils/helper/vueHelper'; |
@@ -6,6 +8,11 @@ import { tabStore, PAGE_LAYOUT_KEY } from '/@/store/modules/tab'; | @@ -6,6 +8,11 @@ import { tabStore, PAGE_LAYOUT_KEY } from '/@/store/modules/tab'; | ||
6 | import { useRouter } from 'vue-router'; | 8 | import { useRouter } from 'vue-router'; |
7 | 9 | ||
8 | const ParentLayoutName = 'ParentLayout'; | 10 | const ParentLayoutName = 'ParentLayout'; |
11 | + | ||
12 | +export function getKey(component: FunctionalComponent & { type: Indexable }, route: RouteLocation) { | ||
13 | + return !!component?.type.parentView ? {} : { key: route.fullPath }; | ||
14 | +} | ||
15 | + | ||
9 | export function useCache(isPage: boolean) { | 16 | export function useCache(isPage: boolean) { |
10 | const name = ref(''); | 17 | const name = ref(''); |
11 | const { currentRoute } = useRouter(); | 18 | const { currentRoute } = useRouter(); |
yarn.lock
@@ -1768,10 +1768,10 @@ | @@ -1768,10 +1768,10 @@ | ||
1768 | "@vue/babel-plugin-jsx" "^1.0.1" | 1768 | "@vue/babel-plugin-jsx" "^1.0.1" |
1769 | hash-sum "^2.0.0" | 1769 | hash-sum "^2.0.0" |
1770 | 1770 | ||
1771 | -"@vitejs/plugin-vue@^1.1.2": | ||
1772 | - version "1.1.2" | ||
1773 | - resolved "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-1.1.2.tgz#64d1f0e0739675f5717015ffb4d861c53af8fe60" | ||
1774 | - integrity sha512-a5ORYuPsiAO4Kb2blA/x63mDiBQBxEJkbjhVtiv5IP/I7fGfpwXPPGHx9LHD4MedpXp8icngJYMKO0hOwahtmQ== | 1771 | +"@vitejs/plugin-vue@1.1.0": |
1772 | + version "1.1.0" | ||
1773 | + resolved "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-1.1.0.tgz#8ae0b11388897b07259c9e5198c0e3fb5e4b37d9" | ||
1774 | + integrity sha512-ExlAt3nb3PB31jV9AgRZSMoGd+aQRU53fc/seghV8/l0JCzaX2mqlgpG8iytWkRxbBPgtAx4TpCPdiVKnTFT/A== | ||
1775 | 1775 | ||
1776 | "@vue/babel-helper-vue-transform-on@^1.0.2": | 1776 | "@vue/babel-helper-vue-transform-on@^1.0.2": |
1777 | version "1.0.2" | 1777 | version "1.0.2" |