mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 00:09:16 +08:00
feat: Menu enables vue-router mode (#7681)
This commit is contained in:
parent
ec3024f2c3
commit
b9be79b05a
@ -36,7 +36,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</back-button>
|
</back-button>
|
||||||
|
|
||||||
<span v-else class="flex justify-between items-start sm:items-center flex-col sm:flex-row">
|
<span v-else>
|
||||||
{{ title }}
|
{{ title }}
|
||||||
<span v-if="slots.buttons">
|
<span v-if="slots.buttons">
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<el-menu
|
<el-menu
|
||||||
:default-active="activeMenu"
|
:default-active="activeMenu"
|
||||||
:router="menuRouter"
|
:router="true"
|
||||||
:collapse="isCollapse"
|
:collapse="isCollapse"
|
||||||
:collapse-transition="false"
|
:collapse-transition="false"
|
||||||
:unique-opened="true"
|
:unique-opened="true"
|
||||||
@ -21,12 +21,12 @@
|
|||||||
class="custom-menu"
|
class="custom-menu"
|
||||||
>
|
>
|
||||||
<SubItem :menuList="routerMenus" />
|
<SubItem :menuList="routerMenus" />
|
||||||
<el-menu-item :index="''">
|
<el-menu-item :index="''" @click="logout">
|
||||||
<el-icon @click="logout">
|
<el-icon>
|
||||||
<SvgIcon :iconName="'p-logout'" />
|
<SvgIcon :iconName="'p-logout'" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<template #title>
|
<template #title>
|
||||||
<span @click="logout">{{ $t('commons.login.logout') }}</span>
|
<span>{{ $t('commons.login.logout') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
@ -55,13 +55,7 @@ import PrimaryMenu from '@/assets/images/menu-bg.svg?component';
|
|||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const menuStore = MenuStore();
|
const menuStore = MenuStore();
|
||||||
const globalStore = GlobalStore();
|
const globalStore = GlobalStore();
|
||||||
defineProps({
|
|
||||||
menuRouter: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const activeMenu = computed(() => {
|
const activeMenu = computed(() => {
|
||||||
const { meta, path } = route;
|
const { meta, path } = route;
|
||||||
return isString(meta.activeMenu) ? meta.activeMenu : path;
|
return isString(meta.activeMenu) ? meta.activeMenu : path;
|
||||||
@ -201,13 +195,6 @@ onMounted(() => {
|
|||||||
line-height: normal;
|
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 {
|
.sidebar-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div :class="classObj" class="app-wrapper" v-loading="loading" :element-loading-text="loadingText" fullscreen>
|
<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 v-if="classObj.mobile && classObj.openSidebar" class="drawer-bg" @click="handleClickOutside" />
|
||||||
<div class="app-sidebar" v-if="!globalStore.isFullScreen">
|
<div class="app-sidebar" v-if="!globalStore.isFullScreen">
|
||||||
<Sidebar @menu-click="handleMenuClick" :menu-router="!classObj.openMenuTabs" />
|
<Sidebar @menu-click="handleMenuClick" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
|
@ -85,7 +85,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|||||||
],
|
],
|
||||||
esbuild: {
|
esbuild: {
|
||||||
pure: viteEnv.VITE_DROP_CONSOLE ? ['console.log'] : [],
|
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: {
|
build: {
|
||||||
outDir: '../cmd/server/web',
|
outDir: '../cmd/server/web',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user