-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat: Menu enables vue-router mode #7681
Changes from all commits
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 |
---|---|---|
|
@@ -13,20 +13,20 @@ | |
<el-scrollbar> | ||
<el-menu | ||
:default-active="activeMenu" | ||
:router="menuRouter" | ||
:router="true" | ||
:collapse="isCollapse" | ||
:collapse-transition="false" | ||
:unique-opened="true" | ||
@select="handleMenuClick" | ||
class="custom-menu" | ||
> | ||
<SubItem :menuList="routerMenus" /> | ||
<el-menu-item :index="''"> | ||
<el-icon @click="logout"> | ||
<el-menu-item :index="''" @click="logout"> | ||
<el-icon> | ||
<SvgIcon :iconName="'p-logout'" /> | ||
</el-icon> | ||
<template #title> | ||
<span @click="logout">{{ $t('commons.login.logout') }}</span> | ||
<span>{{ $t('commons.login.logout') }}</span> | ||
</template> | ||
</el-menu-item> | ||
</el-menu> | ||
|
@@ -55,13 +55,7 @@ import PrimaryMenu from '@/assets/images/menu-bg.svg?component'; | |
const route = useRoute(); | ||
const menuStore = MenuStore(); | ||
const globalStore = GlobalStore(); | ||
defineProps({ | ||
menuRouter: { | ||
type: Boolean, | ||
default: true, | ||
required: false, | ||
}, | ||
}); | ||
|
||
const activeMenu = computed(() => { | ||
const { meta, path } = route; | ||
return isString(meta.activeMenu) ? meta.activeMenu : path; | ||
|
@@ -201,13 +195,6 @@ onMounted(() => { | |
line-height: normal; | ||
} | ||
|
||
.custom-menu .el-menu-item { | ||
white-space: normal !important; | ||
word-break: break-word; | ||
overflow-wrap: break-word; | ||
line-height: normal; | ||
} | ||
|
||
.sidebar-container { | ||
position: relative; | ||
display: flex; | ||
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. No significant issues were found; however, there are some minor improvements that can be made to enhance readability and maintainability:
-defineProps({
These changes will make the code cleaner and more readable without introducing any functionality loss. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
<div :class="classObj" class="app-wrapper" v-loading="loading" :element-loading-text="loadingText" fullscreen> | ||
<div v-if="classObj.mobile && classObj.openSidebar" class="drawer-bg" @click="handleClickOutside" /> | ||
<div class="app-sidebar" v-if="!globalStore.isFullScreen"> | ||
<Sidebar @menu-click="handleMenuClick" :menu-router="!classObj.openMenuTabs" /> | ||
<Sidebar @menu-click="handleMenuClick" /> | ||
</div> | ||
|
||
<div class="main-container"> | ||
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. There is an inconsistency between the conditional rendering of both Here's a revised version with consistent logic: @@ -2,7 +2,7 @@
<div :class="classObj" class="app-wrapper" v-loading="loading" :element-loading-text="loadingText" fullscreen>
<div v-if="classObj.mobile && classObj.openSidebar" class="drawer-bg" @click="handleClickOutside" />
<div class="app-sidebar" :key="sidebarKey"
- v-if=" !classObj.mobile || globalStore.isFullScreen">
+ v-if=" globalStore.isFullScreen || (classObj.mobile && classObj.openSideBar) "> In this revision, I've consolidated the conditions so that only one instance of Additionally, adding a unique key ( After making these changes, ensure that your Vuex store ( |
||
|
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.
There is no visible issue in the code snippet provided between lines 36 and 40 of the difference file. The changes appear to be simply refactoring the
v-if
statement, which should not affect functionality or layout.If you want me to perform more thorough checks or provide additional suggestions based on broader code context or specific requirements, please let me know!