Commit d5d4c4b4136158e061e4a3b6b306af6d4e8cd621
1 parent
491f1fcf
fix(menu): fix menu icon missing close #328
Showing
10 changed files
with
22 additions
and
146 deletions
src/components/Menu/index.ts
1 | -import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; | |
1 | +// import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; | |
2 | 2 | |
3 | 3 | import BasicMenu from './src/BasicMenu.vue'; |
4 | 4 | |
5 | 5 | // export const BasicMenu = createAsyncComponent(() => import('./src/BasicMenu.vue')); |
6 | 6 | |
7 | -export const MenuTag = createAsyncComponent(() => import('./src/components/MenuItemTag.vue')); | |
7 | +// export const MenuTag = createAsyncComponent(() => import('./src/components/MenuItemTag.vue')); | |
8 | 8 | |
9 | 9 | export { BasicMenu }; | ... | ... |
src/components/Menu/src/components/ExpandIcon.vue deleted
100644 → 0
1 | -<template> | |
2 | - <BasicArrow :expand="getIsOpen" bottom inset :class="getWrapperClass" /> | |
3 | -</template> | |
4 | -<script lang="ts"> | |
5 | - import { defineComponent, PropType, computed } from 'vue'; | |
6 | - import { useDesign } from '/@/hooks/web/useDesign'; | |
7 | - import { BasicArrow } from '/@/components/Basic'; | |
8 | - | |
9 | - import { propTypes } from '/@/utils/propTypes'; | |
10 | - export default defineComponent({ | |
11 | - name: 'BasicMenuItem', | |
12 | - components: { BasicArrow }, | |
13 | - props: { | |
14 | - key: propTypes.string, | |
15 | - openKeys: { | |
16 | - type: Array as PropType<string[]>, | |
17 | - default: [], | |
18 | - }, | |
19 | - collapsed: propTypes.bool, | |
20 | - }, | |
21 | - setup(props) { | |
22 | - const { prefixCls } = useDesign('basic-menu'); | |
23 | - | |
24 | - const getIsOpen = computed(() => { | |
25 | - return props.openKeys.includes(props.key); | |
26 | - }); | |
27 | - | |
28 | - const getWrapperClass = computed(() => { | |
29 | - return [ | |
30 | - `${prefixCls}__expand-icon`, | |
31 | - { | |
32 | - [`${prefixCls}__expand-icon--collapsed`]: props.collapsed, | |
33 | - }, | |
34 | - ]; | |
35 | - }); | |
36 | - return { | |
37 | - prefixCls, | |
38 | - getIsOpen, | |
39 | - getWrapperClass, | |
40 | - }; | |
41 | - }, | |
42 | - }); | |
43 | -</script> |
src/components/Menu/src/components/MenuItemTag.vue deleted
100644 → 0
1 | -<template> | |
2 | - <span :class="getTagClass" v-if="getShowTag">{{ getContent }}</span> | |
3 | -</template> | |
4 | -<script lang="ts"> | |
5 | - import { defineComponent, computed } from 'vue'; | |
6 | - | |
7 | - import { useDesign } from '/@/hooks/web/useDesign'; | |
8 | - import { contentProps } from '../props'; | |
9 | - | |
10 | - export default defineComponent({ | |
11 | - name: 'MenuItemTag', | |
12 | - props: contentProps, | |
13 | - setup(props) { | |
14 | - const { prefixCls } = useDesign('basic-menu-item-tag'); | |
15 | - | |
16 | - const getShowTag = computed(() => { | |
17 | - const { item, showTitle, isHorizontal } = props; | |
18 | - | |
19 | - if (!item || showTitle || isHorizontal) return false; | |
20 | - | |
21 | - const { tag } = item; | |
22 | - if (!tag) return false; | |
23 | - | |
24 | - const { dot, content } = tag; | |
25 | - if (!dot && !content) return false; | |
26 | - return true; | |
27 | - }); | |
28 | - | |
29 | - const getContent = computed(() => { | |
30 | - if (!getShowTag.value) return ''; | |
31 | - const { item } = props; | |
32 | - const { tag } = item; | |
33 | - const { dot, content } = tag!; | |
34 | - return dot ? '' : content; | |
35 | - }); | |
36 | - | |
37 | - const getTagClass = computed(() => { | |
38 | - const { item } = props; | |
39 | - const { tag = {} } = item || {}; | |
40 | - const { dot, type = 'error' } = tag; | |
41 | - return [ | |
42 | - prefixCls, | |
43 | - [`${prefixCls}--${type}`], | |
44 | - { | |
45 | - [`${prefixCls}--dot`]: dot, | |
46 | - }, | |
47 | - ]; | |
48 | - }); | |
49 | - return { | |
50 | - prefixCls, | |
51 | - getTagClass, | |
52 | - getShowTag, | |
53 | - getContent, | |
54 | - }; | |
55 | - }, | |
56 | - }); | |
57 | -</script> |
src/components/SimpleMenu/index.ts
src/components/SimpleMenu/src/SimpleMenuTag.vue
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | import { defineComponent, computed } from 'vue'; |
9 | 9 | |
10 | 10 | import { useDesign } from '/@/hooks/web/useDesign'; |
11 | + import { propTypes } from '/@/utils/propTypes'; | |
11 | 12 | |
12 | 13 | export default defineComponent({ |
13 | 14 | name: 'SimpleMenuTag', |
... | ... | @@ -16,10 +17,8 @@ |
16 | 17 | type: Object as PropType<Menu>, |
17 | 18 | default: {}, |
18 | 19 | }, |
19 | - collapseParent: { | |
20 | - type: Boolean as PropType<boolean>, | |
21 | - default: false, | |
22 | - }, | |
20 | + dot: propTypes.bool, | |
21 | + collapseParent: propTypes.bool, | |
23 | 22 | }, |
24 | 23 | setup(props) { |
25 | 24 | const { prefixCls } = useDesign('simple-menu'); |
... | ... | @@ -56,7 +55,7 @@ |
56 | 55 | [`${tagCls}--${type}`], |
57 | 56 | { |
58 | 57 | [`${tagCls}--collapse`]: collapseParent, |
59 | - [`${tagCls}--dot`]: dot, | |
58 | + [`${tagCls}--dot`]: dot || props.dot, | |
60 | 59 | }, |
61 | 60 | ]; |
62 | 61 | }); | ... | ... |
src/layouts/default/sider/MixSider.vue
1 | 1 | <template> |
2 | 2 | <div :class="`${prefixCls}-dom`" :style="getDomStyle"></div> |
3 | - | |
4 | 3 | <div |
5 | 4 | v-click-outside="handleClickOutside" |
6 | 5 | :style="getWrapStyle" |
... | ... | @@ -27,15 +26,15 @@ |
27 | 26 | [`${prefixCls}-module__item--active`]: item.path === activePath, |
28 | 27 | }, |
29 | 28 | ]" |
29 | + v-bind="getItemEvents(item)" | |
30 | 30 | v-for="item in menuModules" |
31 | 31 | :key="item.path" |
32 | - v-bind="getItemEvents(item)" | |
33 | 32 | > |
34 | - <MenuTag :item="item" :showTitle="false" :isHorizontal="false" /> | |
33 | + <SimpleMenuTag :item="item" collapseParent dot /> | |
35 | 34 | <Icon |
36 | 35 | :class="`${prefixCls}-module__icon`" |
37 | 36 | :size="getCollapsed ? 16 : 20" |
38 | - :icon="item.meta && item.meta.icon" | |
37 | + :icon="item.icon || (item.meta && item.meta.icon)" | |
39 | 38 | /> |
40 | 39 | <p :class="`${prefixCls}-module__name`"> |
41 | 40 | {{ t(item.name) }} |
... | ... | @@ -85,8 +84,8 @@ |
85 | 84 | |
86 | 85 | import { defineComponent, onMounted, ref, computed, unref } from 'vue'; |
87 | 86 | |
88 | - import { MenuTag } from '/@/components/Menu'; | |
89 | 87 | import { ScrollContainer } from '/@/components/Container'; |
88 | + import { SimpleMenuTag } from '/@/components/SimpleMenu'; | |
90 | 89 | import Icon from '/@/components/Icon'; |
91 | 90 | import { AppLogo } from '/@/components/Application'; |
92 | 91 | import Trigger from '../trigger/HeaderTrigger.vue'; |
... | ... | @@ -111,9 +110,9 @@ |
111 | 110 | ScrollContainer, |
112 | 111 | AppLogo, |
113 | 112 | SimpleMenu, |
114 | - MenuTag, | |
115 | 113 | Icon, |
116 | 114 | Trigger, |
115 | + SimpleMenuTag, | |
117 | 116 | }, |
118 | 117 | directives: { |
119 | 118 | clickOutside, |
... | ... | @@ -337,8 +336,6 @@ |
337 | 336 | </script> |
338 | 337 | <style lang="less"> |
339 | 338 | @prefix-cls: ~'@{namespace}-layout-mix-sider'; |
340 | - @tag-prefix-cls: ~'@{namespace}-basic-menu-item-tag'; | |
341 | - @menu-prefix-cls: ~'@{namespace}-menu'; | |
342 | 339 | @width: 80px; |
343 | 340 | .@{prefix-cls} { |
344 | 341 | position: fixed; |
... | ... | @@ -349,15 +346,6 @@ |
349 | 346 | overflow: hidden; |
350 | 347 | background: @sider-dark-bg-color; |
351 | 348 | transition: all 0.2s ease 0s; |
352 | - .@{tag-prefix-cls} { | |
353 | - position: absolute; | |
354 | - top: 6px; | |
355 | - right: 2px; | |
356 | - } | |
357 | - | |
358 | - .@{menu-prefix-cls} { | |
359 | - width: 100% !important; | |
360 | - } | |
361 | 349 | |
362 | 350 | &-dom { |
363 | 351 | height: 100%; |
... | ... | @@ -420,7 +408,7 @@ |
420 | 408 | &.dark { |
421 | 409 | &.open { |
422 | 410 | .@{prefix-cls}-logo { |
423 | - border-bottom: 1px solid @border-color; | |
411 | + // border-bottom: 1px solid @border-color; | |
424 | 412 | } |
425 | 413 | |
426 | 414 | > .scrollbar { |
... | ... | @@ -524,16 +512,6 @@ |
524 | 512 | height: calc(100%); |
525 | 513 | background: #fff; |
526 | 514 | transition: all 0.2s; |
527 | - .@{tag-prefix-cls} { | |
528 | - position: absolute; | |
529 | - top: 10px; | |
530 | - right: 30px; | |
531 | - | |
532 | - &--dot { | |
533 | - top: 50%; | |
534 | - margin-top: -3px; | |
535 | - } | |
536 | - } | |
537 | 515 | |
538 | 516 | &__title { |
539 | 517 | display: flex; | ... | ... |
src/layouts/default/sider/index.vue
src/main.ts
... | ... | @@ -27,10 +27,11 @@ import { isDevMode } from '/@/utils/env'; |
27 | 27 | |
28 | 28 | (async () => { |
29 | 29 | const app = createApp(App); |
30 | - | |
31 | 30 | // Register global components |
32 | 31 | registerGlobComp(app); |
33 | 32 | |
33 | + // Multilingual configuration | |
34 | + await setupI18n(app); | |
34 | 35 | // Configure routing |
35 | 36 | setupRouter(app); |
36 | 37 | |
... | ... | @@ -43,12 +44,8 @@ import { isDevMode } from '/@/utils/env'; |
43 | 44 | // Configure global error handling |
44 | 45 | setupErrorHandle(app); |
45 | 46 | |
46 | - await Promise.all([ | |
47 | - // Multilingual configuration | |
48 | - setupI18n(app), | |
49 | - // Mount when the route is ready | |
50 | - router.isReady(), | |
51 | - ]); | |
47 | + // Mount when the route is ready | |
48 | + await router.isReady(); | |
52 | 49 | |
53 | 50 | app.mount('#app', true); |
54 | 51 | ... | ... |
src/store/modules/permission.ts
... | ... | @@ -18,7 +18,7 @@ import { transformObjToRoute } from '/@/router/helper/routeHelper'; |
18 | 18 | import { transformRouteToMenu } from '/@/router/helper/menuHelper'; |
19 | 19 | |
20 | 20 | import { useMessage } from '/@/hooks/web/useMessage'; |
21 | -// import { useI18n } from '/@/hooks/web/useI18n'; | |
21 | +import { useI18n } from '/@/hooks/web/useI18n'; | |
22 | 22 | import { ERROR_LOG_ROUTE, PAGE_NOT_FOUND_ROUTE } from '/@/router/constant'; |
23 | 23 | |
24 | 24 | const { createMessage } = useMessage(); |
... | ... | @@ -84,7 +84,7 @@ class Permission extends VuexModule { |
84 | 84 | |
85 | 85 | @Action |
86 | 86 | async buildRoutesAction(id?: number | string): Promise<AppRouteRecordRaw[]> { |
87 | - // const { t } = useI18n(); | |
87 | + const { t } = useI18n(); | |
88 | 88 | let routes: AppRouteRecordRaw[] = []; |
89 | 89 | const roleList = toRaw(userStore.getRoleListState); |
90 | 90 | |
... | ... | @@ -101,8 +101,7 @@ class Permission extends VuexModule { |
101 | 101 | // If you are sure that you do not need to do background dynamic permissions, please comment the entire judgment below |
102 | 102 | } else if (permissionMode === PermissionModeEnum.BACK) { |
103 | 103 | createMessage.loading({ |
104 | - content: 'Loading menu...', | |
105 | - // content: 't('sys.app.menuLoading')', | |
104 | + content: t('sys.app.menuLoading'), | |
106 | 105 | duration: 1, |
107 | 106 | }); |
108 | 107 | // Here to get the background routing menu logic to modify by yourself | ... | ... |
stylelint.config.js