Skip to content

Commit

Permalink
feat: Menu enables vue-router mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lan-yonghui committed Jan 9, 2025
1 parent 070f61e commit 1d3690b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/layout-content/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</template>
</back-button>

<span v-else class="flex justify-between items-start sm:items-center flex-col sm:flex-row">
<span v-else>
{{ title }}
<span v-if="slots.buttons">
<el-divider direction="vertical" />
Expand Down
23 changes: 5 additions & 18 deletions frontend/src/layout/components/Sidebar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/layout/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
],
esbuild: {
pure: viteEnv.VITE_DROP_CONSOLE ? ['console.log'] : [],
drop: viteEnv.VITE_DROP_CONSOLE ? ['debugger'] : [],
drop: viteEnv.VITE_DROP_CONSOLE && process.env.NODE_ENV === 'production' ? ['debugger'] : [],
},
build: {
outDir: '../cmd/server/web',
Expand Down

0 comments on commit 1d3690b

Please sign in to comment.