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 | import BasicMenu from './src/BasicMenu.vue'; | 3 | import BasicMenu from './src/BasicMenu.vue'; |
4 | 4 | ||
5 | // export const BasicMenu = createAsyncComponent(() => import('./src/BasicMenu.vue')); | 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 | export { BasicMenu }; | 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,6 +8,7 @@ | ||
8 | import { defineComponent, computed } from 'vue'; | 8 | import { defineComponent, computed } from 'vue'; |
9 | 9 | ||
10 | import { useDesign } from '/@/hooks/web/useDesign'; | 10 | import { useDesign } from '/@/hooks/web/useDesign'; |
11 | + import { propTypes } from '/@/utils/propTypes'; | ||
11 | 12 | ||
12 | export default defineComponent({ | 13 | export default defineComponent({ |
13 | name: 'SimpleMenuTag', | 14 | name: 'SimpleMenuTag', |
@@ -16,10 +17,8 @@ | @@ -16,10 +17,8 @@ | ||
16 | type: Object as PropType<Menu>, | 17 | type: Object as PropType<Menu>, |
17 | default: {}, | 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 | setup(props) { | 23 | setup(props) { |
25 | const { prefixCls } = useDesign('simple-menu'); | 24 | const { prefixCls } = useDesign('simple-menu'); |
@@ -56,7 +55,7 @@ | @@ -56,7 +55,7 @@ | ||
56 | [`${tagCls}--${type}`], | 55 | [`${tagCls}--${type}`], |
57 | { | 56 | { |
58 | [`${tagCls}--collapse`]: collapseParent, | 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 | <template> | 1 | <template> |
2 | <div :class="`${prefixCls}-dom`" :style="getDomStyle"></div> | 2 | <div :class="`${prefixCls}-dom`" :style="getDomStyle"></div> |
3 | - | ||
4 | <div | 3 | <div |
5 | v-click-outside="handleClickOutside" | 4 | v-click-outside="handleClickOutside" |
6 | :style="getWrapStyle" | 5 | :style="getWrapStyle" |
@@ -27,15 +26,15 @@ | @@ -27,15 +26,15 @@ | ||
27 | [`${prefixCls}-module__item--active`]: item.path === activePath, | 26 | [`${prefixCls}-module__item--active`]: item.path === activePath, |
28 | }, | 27 | }, |
29 | ]" | 28 | ]" |
29 | + v-bind="getItemEvents(item)" | ||
30 | v-for="item in menuModules" | 30 | v-for="item in menuModules" |
31 | :key="item.path" | 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 | <Icon | 34 | <Icon |
36 | :class="`${prefixCls}-module__icon`" | 35 | :class="`${prefixCls}-module__icon`" |
37 | :size="getCollapsed ? 16 : 20" | 36 | :size="getCollapsed ? 16 : 20" |
38 | - :icon="item.meta && item.meta.icon" | 37 | + :icon="item.icon || (item.meta && item.meta.icon)" |
39 | /> | 38 | /> |
40 | <p :class="`${prefixCls}-module__name`"> | 39 | <p :class="`${prefixCls}-module__name`"> |
41 | {{ t(item.name) }} | 40 | {{ t(item.name) }} |
@@ -85,8 +84,8 @@ | @@ -85,8 +84,8 @@ | ||
85 | 84 | ||
86 | import { defineComponent, onMounted, ref, computed, unref } from 'vue'; | 85 | import { defineComponent, onMounted, ref, computed, unref } from 'vue'; |
87 | 86 | ||
88 | - import { MenuTag } from '/@/components/Menu'; | ||
89 | import { ScrollContainer } from '/@/components/Container'; | 87 | import { ScrollContainer } from '/@/components/Container'; |
88 | + import { SimpleMenuTag } from '/@/components/SimpleMenu'; | ||
90 | import Icon from '/@/components/Icon'; | 89 | import Icon from '/@/components/Icon'; |
91 | import { AppLogo } from '/@/components/Application'; | 90 | import { AppLogo } from '/@/components/Application'; |
92 | import Trigger from '../trigger/HeaderTrigger.vue'; | 91 | import Trigger from '../trigger/HeaderTrigger.vue'; |
@@ -111,9 +110,9 @@ | @@ -111,9 +110,9 @@ | ||
111 | ScrollContainer, | 110 | ScrollContainer, |
112 | AppLogo, | 111 | AppLogo, |
113 | SimpleMenu, | 112 | SimpleMenu, |
114 | - MenuTag, | ||
115 | Icon, | 113 | Icon, |
116 | Trigger, | 114 | Trigger, |
115 | + SimpleMenuTag, | ||
117 | }, | 116 | }, |
118 | directives: { | 117 | directives: { |
119 | clickOutside, | 118 | clickOutside, |
@@ -337,8 +336,6 @@ | @@ -337,8 +336,6 @@ | ||
337 | </script> | 336 | </script> |
338 | <style lang="less"> | 337 | <style lang="less"> |
339 | @prefix-cls: ~'@{namespace}-layout-mix-sider'; | 338 | @prefix-cls: ~'@{namespace}-layout-mix-sider'; |
340 | - @tag-prefix-cls: ~'@{namespace}-basic-menu-item-tag'; | ||
341 | - @menu-prefix-cls: ~'@{namespace}-menu'; | ||
342 | @width: 80px; | 339 | @width: 80px; |
343 | .@{prefix-cls} { | 340 | .@{prefix-cls} { |
344 | position: fixed; | 341 | position: fixed; |
@@ -349,15 +346,6 @@ | @@ -349,15 +346,6 @@ | ||
349 | overflow: hidden; | 346 | overflow: hidden; |
350 | background: @sider-dark-bg-color; | 347 | background: @sider-dark-bg-color; |
351 | transition: all 0.2s ease 0s; | 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 | &-dom { | 350 | &-dom { |
363 | height: 100%; | 351 | height: 100%; |
@@ -420,7 +408,7 @@ | @@ -420,7 +408,7 @@ | ||
420 | &.dark { | 408 | &.dark { |
421 | &.open { | 409 | &.open { |
422 | .@{prefix-cls}-logo { | 410 | .@{prefix-cls}-logo { |
423 | - border-bottom: 1px solid @border-color; | 411 | + // border-bottom: 1px solid @border-color; |
424 | } | 412 | } |
425 | 413 | ||
426 | > .scrollbar { | 414 | > .scrollbar { |
@@ -524,16 +512,6 @@ | @@ -524,16 +512,6 @@ | ||
524 | height: calc(100%); | 512 | height: calc(100%); |
525 | background: #fff; | 513 | background: #fff; |
526 | transition: all 0.2s; | 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 | &__title { | 516 | &__title { |
539 | display: flex; | 517 | display: flex; |
src/layouts/default/sider/index.vue
@@ -43,6 +43,7 @@ | @@ -43,6 +43,7 @@ | ||
43 | </script> | 43 | </script> |
44 | <style lang="less"> | 44 | <style lang="less"> |
45 | @prefix-cls: ~'@{namespace}-layout-sider-wrapper'; | 45 | @prefix-cls: ~'@{namespace}-layout-sider-wrapper'; |
46 | + | ||
46 | .@{prefix-cls} { | 47 | .@{prefix-cls} { |
47 | .ant-drawer-body { | 48 | .ant-drawer-body { |
48 | height: 100vh; | 49 | height: 100vh; |
src/main.ts
@@ -27,10 +27,11 @@ import { isDevMode } from '/@/utils/env'; | @@ -27,10 +27,11 @@ import { isDevMode } from '/@/utils/env'; | ||
27 | 27 | ||
28 | (async () => { | 28 | (async () => { |
29 | const app = createApp(App); | 29 | const app = createApp(App); |
30 | - | ||
31 | // Register global components | 30 | // Register global components |
32 | registerGlobComp(app); | 31 | registerGlobComp(app); |
33 | 32 | ||
33 | + // Multilingual configuration | ||
34 | + await setupI18n(app); | ||
34 | // Configure routing | 35 | // Configure routing |
35 | setupRouter(app); | 36 | setupRouter(app); |
36 | 37 | ||
@@ -43,12 +44,8 @@ import { isDevMode } from '/@/utils/env'; | @@ -43,12 +44,8 @@ import { isDevMode } from '/@/utils/env'; | ||
43 | // Configure global error handling | 44 | // Configure global error handling |
44 | setupErrorHandle(app); | 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 | app.mount('#app', true); | 50 | app.mount('#app', true); |
54 | 51 |
src/store/modules/permission.ts
@@ -18,7 +18,7 @@ import { transformObjToRoute } from '/@/router/helper/routeHelper'; | @@ -18,7 +18,7 @@ import { transformObjToRoute } from '/@/router/helper/routeHelper'; | ||
18 | import { transformRouteToMenu } from '/@/router/helper/menuHelper'; | 18 | import { transformRouteToMenu } from '/@/router/helper/menuHelper'; |
19 | 19 | ||
20 | import { useMessage } from '/@/hooks/web/useMessage'; | 20 | import { useMessage } from '/@/hooks/web/useMessage'; |
21 | -// import { useI18n } from '/@/hooks/web/useI18n'; | 21 | +import { useI18n } from '/@/hooks/web/useI18n'; |
22 | import { ERROR_LOG_ROUTE, PAGE_NOT_FOUND_ROUTE } from '/@/router/constant'; | 22 | import { ERROR_LOG_ROUTE, PAGE_NOT_FOUND_ROUTE } from '/@/router/constant'; |
23 | 23 | ||
24 | const { createMessage } = useMessage(); | 24 | const { createMessage } = useMessage(); |
@@ -84,7 +84,7 @@ class Permission extends VuexModule { | @@ -84,7 +84,7 @@ class Permission extends VuexModule { | ||
84 | 84 | ||
85 | @Action | 85 | @Action |
86 | async buildRoutesAction(id?: number | string): Promise<AppRouteRecordRaw[]> { | 86 | async buildRoutesAction(id?: number | string): Promise<AppRouteRecordRaw[]> { |
87 | - // const { t } = useI18n(); | 87 | + const { t } = useI18n(); |
88 | let routes: AppRouteRecordRaw[] = []; | 88 | let routes: AppRouteRecordRaw[] = []; |
89 | const roleList = toRaw(userStore.getRoleListState); | 89 | const roleList = toRaw(userStore.getRoleListState); |
90 | 90 | ||
@@ -101,8 +101,7 @@ class Permission extends VuexModule { | @@ -101,8 +101,7 @@ class Permission extends VuexModule { | ||
101 | // If you are sure that you do not need to do background dynamic permissions, please comment the entire judgment below | 101 | // If you are sure that you do not need to do background dynamic permissions, please comment the entire judgment below |
102 | } else if (permissionMode === PermissionModeEnum.BACK) { | 102 | } else if (permissionMode === PermissionModeEnum.BACK) { |
103 | createMessage.loading({ | 103 | createMessage.loading({ |
104 | - content: 'Loading menu...', | ||
105 | - // content: 't('sys.app.menuLoading')', | 104 | + content: t('sys.app.menuLoading'), |
106 | duration: 1, | 105 | duration: 1, |
107 | }); | 106 | }); |
108 | // Here to get the background routing menu logic to modify by yourself | 107 | // Here to get the background routing menu logic to modify by yourself |
stylelint.config.js
@@ -16,6 +16,7 @@ module.exports = { | @@ -16,6 +16,7 @@ module.exports = { | ||
16 | }, | 16 | }, |
17 | ], | 17 | ], |
18 | 'no-empty-source': null, | 18 | 'no-empty-source': null, |
19 | + 'named-grid-areas-no-invalid': null, | ||
19 | 'unicode-bom': 'never', | 20 | 'unicode-bom': 'never', |
20 | 'no-descending-specificity': null, | 21 | 'no-descending-specificity': null, |
21 | 'font-family-no-missing-generic-family-keyword': null, | 22 | 'font-family-no-missing-generic-family-keyword': null, |