Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c28adc9a
authored
May 22, 2024
by
vben
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: The accordion mode of the menu is configurable
1 parent
a0423eb9
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
30 additions
and
3 deletions
packages/@vben-core/shared/typings/src/preference.ts
packages/business/common-ui/src/preference/blocks/layout/navigation.vue
packages/business/common-ui/src/preference/preference-widget.vue
packages/business/common-ui/src/preference/preference.vue
packages/business/layouts/src/basic/content/content.vue
packages/business/layouts/src/basic/layout.vue
packages/business/layouts/src/basic/menu/extra-menu.vue
packages/business/layouts/src/basic/menu/menu.vue
packages/locales/src/langs/en-US.yaml
packages/locales/src/langs/zh-CN.yaml
packages/preference/src/config.ts
packages/stores/src/modules/tabs.ts
packages/@vben-core/shared/typings/src/preference.ts
View file @
c28adc9
...
@@ -77,6 +77,8 @@ interface Preference {
...
@@ -77,6 +77,8 @@ interface Preference {
logo
:
string
;
logo
:
string
;
/** logo是否可见 */
/** logo是否可见 */
logoVisible
:
boolean
;
logoVisible
:
boolean
;
/** 导航菜单手风琴模式 */
navigationAccordion
:
boolean
;
/** 导航菜单是否切割,只在 layout=mixed-nav 生效 */
/** 导航菜单是否切割,只在 layout=mixed-nav 生效 */
navigationSplit
:
boolean
;
navigationSplit
:
boolean
;
/** 导航菜单风格 */
/** 导航菜单风格 */
...
...
packages/business/common-ui/src/preference/blocks/layout/navigation.vue
View file @
c28adc9
...
@@ -14,6 +14,7 @@ defineProps<{ disabled?: boolean; disabledNavigationSplit?: boolean }>();
...
@@ -14,6 +14,7 @@ defineProps<{ disabled?: boolean; disabledNavigationSplit?: boolean }>();
const
navigationStyle
=
defineModel
<
string
>
(
'navigationStyle'
);
const
navigationStyle
=
defineModel
<
string
>
(
'navigationStyle'
);
const
navigationSplit
=
defineModel
<
boolean
>
(
'navigationSplit'
);
const
navigationSplit
=
defineModel
<
boolean
>
(
'navigationSplit'
);
const
navigationAccordion
=
defineModel
<
boolean
>
(
'navigationAccordion'
);
const
stylesItems
:
SelectListItem
[]
=
[
const
stylesItems
:
SelectListItem
[]
=
[
{
label
:
$t
(
'preference.rounded'
),
value
:
'rounded'
},
{
label
:
$t
(
'preference.rounded'
),
value
:
'rounded'
},
...
@@ -29,10 +30,16 @@ const stylesItems: SelectListItem[] = [
...
@@ -29,10 +30,16 @@ const stylesItems: SelectListItem[] = [
>
>
{{
$t
(
'preference.navigation-style'
)
}}
{{
$t
(
'preference.navigation-style'
)
}}
</ToggleItem>
</ToggleItem>
<SwitchItem
v-model=
"navigationSplit"
:disabled=
"disabledNavigationSplit"
>
<SwitchItem
v-model=
"navigationSplit"
:disabled=
"disabledNavigationSplit || disabled"
>
{{
$t
(
'preference.navigation-split'
)
}}
{{
$t
(
'preference.navigation-split'
)
}}
<template
#
tip
>
<template
#
tip
>
{{
$t
(
'preference.navigation-split-tip'
)
}}
{{
$t
(
'preference.navigation-split-tip'
)
}}
</
template
>
</
template
>
</SwitchItem>
</SwitchItem>
<SwitchItem
v-model=
"navigationAccordion"
:disabled=
"disabled"
>
{{ $t('preference.navigation-accordion') }}
</SwitchItem>
</template>
</template>
packages/business/common-ui/src/preference/preference-widget.vue
View file @
c28adc9
...
@@ -52,11 +52,15 @@ function updateLocale(value: string) {
...
@@ -52,11 +52,15 @@ function updateLocale(value: string) {
:page-progress=
"preference.pageProgress"
:page-progress=
"preference.pageProgress"
:tabs-icon=
"preference.tabsIcon"
:tabs-icon=
"preference.tabsIcon"
:locale=
"preference.locale"
:locale=
"preference.locale"
:navigation-accordion=
"preference.navigationAccordion"
:navigation-style=
"preference.navigationStyle"
:navigation-style=
"preference.navigationStyle"
:navigation-split=
"preference.navigationSplit"
:navigation-split=
"preference.navigationSplit"
:side-collapse-show-title=
"preference.sideCollapseShowTitle"
:side-collapse-show-title=
"preference.sideCollapseShowTitle"
:page-transition-enable=
"preference.pageTransitionEnable"
:page-transition-enable=
"preference.pageTransitionEnable"
@
update:navigation-style=
"(value) => handleUpdate('navigationStyle', value)"
@
update:navigation-style=
"(value) => handleUpdate('navigationStyle', value)"
@
update:navigation-accordion=
"
(value) => handleUpdate('navigationAccordion', value)
"
@
update:navigation-split=
"(value) => handleUpdate('navigationSplit', value)"
@
update:navigation-split=
"(value) => handleUpdate('navigationSplit', value)"
@
update:dynamic-title=
"(value) => handleUpdate('dynamicTitle', value)"
@
update:dynamic-title=
"(value) => handleUpdate('dynamicTitle', value)"
@
update:tabs-icon=
"(value) => handleUpdate('tabsIcon', value)"
@
update:tabs-icon=
"(value) => handleUpdate('tabsIcon', value)"
...
...
packages/business/common-ui/src/preference/preference.vue
View file @
c28adc9
...
@@ -54,6 +54,7 @@ const colorGrayMode = defineModel<boolean>('colorGrayMode');
...
@@ -54,6 +54,7 @@ const colorGrayMode = defineModel<boolean>('colorGrayMode');
const
colorPrimary
=
defineModel
<
string
>
(
'colorPrimary'
);
const
colorPrimary
=
defineModel
<
string
>
(
'colorPrimary'
);
const
navigationStyle
=
defineModel
<
string
>
(
'navigationStyle'
);
const
navigationStyle
=
defineModel
<
string
>
(
'navigationStyle'
);
const
navigationSplit
=
defineModel
<
boolean
>
(
'navigationSplit'
);
const
navigationSplit
=
defineModel
<
boolean
>
(
'navigationSplit'
);
const
navigationAccordion
=
defineModel
<
boolean
>
(
'navigationAccordion'
);
const
pageProgress
=
defineModel
<
boolean
>
(
'pageProgress'
);
const
pageProgress
=
defineModel
<
boolean
>
(
'pageProgress'
);
const
pageTransition
=
defineModel
<
string
>
(
'pageTransition'
);
const
pageTransition
=
defineModel
<
string
>
(
'pageTransition'
);
const
pageTransitionEnable
=
defineModel
<
boolean
>
(
'pageTransitionEnable'
);
const
pageTransitionEnable
=
defineModel
<
boolean
>
(
'pageTransitionEnable'
);
...
@@ -197,6 +198,7 @@ function handleReset() {
...
@@ -197,6 +198,7 @@ function handleReset() {
<Navigation
<Navigation
v-model:navigation-style=
"navigationStyle"
v-model:navigation-style=
"navigationStyle"
v-model:navigation-split=
"navigationSplit"
v-model:navigation-split=
"navigationSplit"
v-model:navigation-accordion=
"navigationAccordion"
:disabled=
"isFullContent"
:disabled=
"isFullContent"
:disabled-navigation-split=
"!isMixedNav"
:disabled-navigation-split=
"!isMixedNav"
/>
/>
...
...
packages/business/layouts/src/basic/content/content.vue
View file @
c28adc9
...
@@ -50,6 +50,7 @@ function getTransitionName(route: RouteLocationNormalizedLoaded) {
...
@@ -50,6 +50,7 @@ function getTransitionName(route: RouteLocationNormalizedLoaded) {
<component
<component
:is=
"Component"
:is=
"Component"
v-if=
"renderRouteView"
v-if=
"renderRouteView"
v-show=
"!route.meta.iframeSrc"
:key=
"route.fullPath"
:key=
"route.fullPath"
class=
"h-[1000px]"
class=
"h-[1000px]"
/>
/>
...
...
packages/business/layouts/src/basic/layout.vue
View file @
c28adc9
...
@@ -183,6 +183,7 @@ function wrapperMenus(menus: MenuRecordRaw[]) {
...
@@ -183,6 +183,7 @@ function wrapperMenus(menus: MenuRecordRaw[]) {
<
template
#
menu
>
<
template
#
menu
>
<LayoutMenu
<LayoutMenu
mode=
"vertical"
mode=
"vertical"
:accordion=
"preference.navigationAccordion"
:rounded=
"isMenuRounded"
:rounded=
"isMenuRounded"
:collapse-show-title=
"preference.sideCollapseShowTitle"
:collapse-show-title=
"preference.sideCollapseShowTitle"
:collapse=
"preference.sideCollapse"
:collapse=
"preference.sideCollapse"
...
@@ -206,6 +207,7 @@ function wrapperMenus(menus: MenuRecordRaw[]) {
...
@@ -206,6 +207,7 @@ function wrapperMenus(menus: MenuRecordRaw[]) {
<!-- 侧边额外区域 -->
<!-- 侧边额外区域 -->
<
template
#
side-extra
>
<
template
#
side-extra
>
<LayoutExtraMenu
<LayoutExtraMenu
:accordion=
"preference.navigationAccordion"
:rounded=
"isMenuRounded"
:rounded=
"isMenuRounded"
:menus=
"wrapperMenus(extraMenus)"
:menus=
"wrapperMenus(extraMenus)"
:collapse=
"preference.sideExtraCollapse"
:collapse=
"preference.sideExtraCollapse"
...
...
packages/business/layouts/src/basic/menu/extra-menu.vue
View file @
c28adc9
...
@@ -12,7 +12,10 @@ interface Props extends MenuProps {
...
@@ -12,7 +12,10 @@ interface Props extends MenuProps {
menus
:
MenuRecordRaw
[];
menus
:
MenuRecordRaw
[];
}
}
defineProps
<
Props
>
();
withDefaults
(
defineProps
<
Props
>
(),
{
accordion
:
true
,
menus
:
()
=>
[],
});
const
route
=
useRoute
();
const
route
=
useRoute
();
const
{
navigation
}
=
useNavigation
();
const
{
navigation
}
=
useNavigation
();
...
@@ -25,6 +28,7 @@ async function handleSelect(key: string) {
...
@@ -25,6 +28,7 @@ async function handleSelect(key: string) {
<
template
>
<
template
>
<Menu
<Menu
:rounded=
"rounded"
:rounded=
"rounded"
:accordion=
"accordion"
:collapse=
"collapse"
:collapse=
"collapse"
:default-active=
"route.path"
:default-active=
"route.path"
:menus=
"menus"
:menus=
"menus"
...
...
packages/business/layouts/src/basic/menu/menu.vue
View file @
c28adc9
...
@@ -8,6 +8,7 @@ interface Props extends MenuProps {
...
@@ -8,6 +8,7 @@ interface Props extends MenuProps {
}
}
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
accordion
:
true
,
menus
:
()
=>
[],
menus
:
()
=>
[],
});
});
...
@@ -25,6 +26,7 @@ function handleMenuSelect(key: string) {
...
@@ -25,6 +26,7 @@ function handleMenuSelect(key: string) {
:rounded=
"rounded"
:rounded=
"rounded"
:collapse-show-title=
"collapseShowTitle"
:collapse-show-title=
"collapseShowTitle"
:collapse=
"collapse"
:collapse=
"collapse"
:accordion=
"accordion"
:default-active=
"defaultActive"
:default-active=
"defaultActive"
:menus=
"menus"
:menus=
"menus"
:theme=
"theme"
:theme=
"theme"
...
...
packages/locales/src/langs/en-US.yaml
View file @
c28adc9
...
@@ -78,6 +78,7 @@ preference:
...
@@ -78,6 +78,7 @@ preference:
navigation-menu
:
Navigation Menu
navigation-menu
:
Navigation Menu
navigation-style
:
Navigation menu style
navigation-style
:
Navigation menu style
navigation-split
:
Navigation Menu Separation
navigation-split
:
Navigation Menu Separation
navigation-accordion
:
Sidebar Navigation Menu Accordion mode
navigation-split-tip
:
When enabled, the sidebar shows the top bar's submenu
navigation-split-tip
:
When enabled, the sidebar shows the top bar's submenu
interface-control
:
Interface Layout Control
interface-control
:
Interface Layout Control
breadcrumb
:
Breadcrumb
breadcrumb
:
Breadcrumb
...
...
packages/locales/src/langs/zh-CN.yaml
View file @
c28adc9
...
@@ -73,6 +73,7 @@ preference:
...
@@ -73,6 +73,7 @@ preference:
animation
:
动画
animation
:
动画
navigation-menu
:
导航菜单
navigation-menu
:
导航菜单
navigation-style
:
导航菜单风格
navigation-style
:
导航菜单风格
navigation-accordion
:
侧边导航菜单手风琴模式
navigation-split
:
导航菜单分离
navigation-split
:
导航菜单分离
navigation-split-tip
:
开启时,侧边栏显示顶栏对应菜单的子菜单
navigation-split-tip
:
开启时,侧边栏显示顶栏对应菜单的子菜单
interface-control
:
界面布局控制
interface-control
:
界面布局控制
...
...
packages/preference/src/config.ts
View file @
c28adc9
...
@@ -27,6 +27,7 @@ const defaultPreference: Preference = {
...
@@ -27,6 +27,7 @@ const defaultPreference: Preference = {
locale
:
'zh-CN'
,
locale
:
'zh-CN'
,
logo
:
'https://cdn.jsdelivr.net/gh/vbenjs/vben-cdn-static@0.1.2/vben-admin/admin-logo.png'
,
logo
:
'https://cdn.jsdelivr.net/gh/vbenjs/vben-cdn-static@0.1.2/vben-admin/admin-logo.png'
,
logoVisible
:
true
,
logoVisible
:
true
,
navigationAccordion
:
true
,
navigationSplit
:
true
,
navigationSplit
:
true
,
navigationStyle
:
'rounded'
,
navigationStyle
:
'rounded'
,
pageProgress
:
true
,
pageProgress
:
true
,
...
...
packages/stores/src/modules/tabs.ts
View file @
c28adc9
...
@@ -269,7 +269,7 @@ const useTabsStore = defineStore('tabs', {
...
@@ -269,7 +269,7 @@ const useTabsStore = defineStore('tabs', {
await
this
.
closeTab
(
this
.
tabs
[
index
],
router
);
await
this
.
closeTab
(
this
.
tabs
[
index
],
router
);
},
},
getTabPath
(
tab
:
RouteRecordNormalized
|
TabItem
)
{
getTabPath
(
tab
:
RouteRecordNormalized
|
TabItem
)
{
return
(
tab
as
TabItem
).
fullPath
||
tab
.
path
;
return
decodeURIComponent
((
tab
as
TabItem
).
fullPath
||
tab
.
path
)
;
},
},
/**
/**
* @zh_CN 固定标签页
* @zh_CN 固定标签页
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment