Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
0419a070
Commit
0419a070
authored
Jan 01, 2021
by
vben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(menu): add mixSideTrigger setting
parent
799a694b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
3 deletions
+42
-3
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+6
-0
useMenuSetting.ts
src/hooks/setting/useMenuSetting.ts
+3
-0
MixSider.vue
src/layouts/default/sider/MixSider.vue
+30
-3
projectSetting.ts
src/settings/projectSetting.ts
+2
-0
config.d.ts
src/types/config.d.ts
+1
-0
No files found.
CHANGELOG.zh_CN.md
View file @
0419a070
## Wip
### ✨ Features
-
新增
`mixSideTrigger`
配置。用于配置左侧混合模式菜单打开方式。可选
`hover`
,默认
`click`
## 2.0.0-rc.15 (2020-12-31)
### ✨ 表格破坏性更新
...
...
src/hooks/setting/useMenuSetting.ts
View file @
0419a070
...
...
@@ -33,6 +33,8 @@ const getSplit = computed(() => unref(getMenuSetting).split);
const
getMenuBgColor
=
computed
(()
=>
unref
(
getMenuSetting
).
bgColor
);
const
getMixSideTrigger
=
computed
(()
=>
unref
(
getMenuSetting
).
mixSideTrigger
);
const
getCanDrag
=
computed
(()
=>
unref
(
getMenuSetting
).
canDrag
);
const
getAccordion
=
computed
(()
=>
unref
(
getMenuSetting
).
accordion
);
...
...
@@ -145,5 +147,6 @@ export function useMenuSetting() {
getIsMixMode
,
getIsMixSidebar
,
getCloseMixSidebarOnChange
,
getMixSideTrigger
,
};
}
src/layouts/default/sider/MixSider.vue
View file @
0419a070
...
...
@@ -10,6 +10,7 @@
open: openMenu,
},
]"
v-bind="getMenuEvents"
>
<AppLogo
:showTitle=
"false"
:class=
"`$
{prefixCls}-logo`" />
<ScrollContainer>
...
...
@@ -23,7 +24,7 @@
]"
v-for="item in menuModules"
:key="item.path"
@click="hanldeModuleClick(item.path
)"
v-bind="getItemEvents(item
)"
>
<MenuTag
:item=
"item"
:showTitle=
"false"
:isHorizontal=
"false"
/>
<g-icon
...
...
@@ -112,6 +113,7 @@
getCanDrag
,
getCloseMixSidebarOnChange
,
getMenuTheme
,
getMixSideTrigger
,
}
=
useMenuSetting
();
const
{
title
}
=
useGlobSetting
();
...
...
@@ -125,6 +127,16 @@
}
);
const
getMenuEvents
=
computed
(()
=>
{
return
unref
(
getMixSideTrigger
)
===
'
hover
'
?
{
onMouseleave
:
()
=>
{
openMenu
.
value
=
false
;
},
}
:
{};
});
const
getShowDragBar
=
computed
(()
=>
unref
(
getCanDrag
));
onMounted
(
async
()
=>
{
...
...
@@ -139,11 +151,13 @@
}
});
async
function
hanldeModuleClick
(
path
:
string
)
{
async
function
hanldeModuleClick
(
path
:
string
,
hover
=
false
)
{
const
children
=
await
getChildrenMenus
(
path
);
if
(
unref
(
activePath
)
===
path
)
{
openMenu
.
value
=
!
unref
(
openMenu
);
if
(
!
hover
)
{
openMenu
.
value
=
!
unref
(
openMenu
);
}
if
(
!
unref
(
openMenu
))
{
setActive
();
}
...
...
@@ -178,6 +192,17 @@
setActive
();
}
function
getItemEvents
(
item
:
Menu
)
{
if
(
unref
(
getMixSideTrigger
)
===
'
hover
'
)
{
return
{
onMouseenter
:
()
=>
hanldeModuleClick
(
item
.
path
,
true
),
};
}
return
{
onClick
:
()
=>
hanldeModuleClick
(
item
.
path
),
};
}
return
{
t
,
prefixCls
,
...
...
@@ -194,6 +219,8 @@
title
,
openMenu
,
getMenuTheme
,
getItemEvents
,
getMenuEvents
,
};
},
});
...
...
src/settings/projectSetting.ts
View file @
0419a070
...
...
@@ -108,6 +108,8 @@ const setting: ProjectConfig = {
accordion
:
true
,
// Switch page to close menu
closeMixSidebarOnChange
:
false
,
// Module opening method ‘click’ |'hover'
mixSideTrigger
:
'
hover
'
,
},
// Multi-label
...
...
src/types/config.d.ts
View file @
0419a070
...
...
@@ -20,6 +20,7 @@ export interface MenuSetting {
accordion
:
boolean
;
closeMixSidebarOnChange
:
boolean
;
collapsedShowTitle
:
boolean
;
mixSideTrigger
:
'
click
'
|
'
hover
'
;
}
export
interface
MultiTabsSetting
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment