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
ee1c3498
Commit
ee1c3498
authored
Apr 08, 2021
by
Vben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(menu): improve menu logic, fix #461
parent
780a8a67
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
66 additions
and
33 deletions
+66
-33
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+1
-0
AppDarkModeToggle.vue
src/components/Application/src/AppDarkModeToggle.vue
+16
-17
index.vue
src/components/Icon/src/index.vue
+1
-5
SimpleMenu.vue
src/components/SimpleMenu/src/SimpleMenu.vue
+12
-1
Menu.vue
src/components/SimpleMenu/src/components/Menu.vue
+9
-0
MenuItem.vue
src/components/SimpleMenu/src/components/MenuItem.vue
+7
-2
SubMenuItem.vue
src/components/SimpleMenu/src/components/SubMenuItem.vue
+10
-3
useOpenKeys.ts
src/components/SimpleMenu/src/useOpenKeys.ts
+1
-1
index.vue
src/layouts/default/menu/index.vue
+2
-1
SettingDrawer.tsx
src/layouts/default/setting/SettingDrawer.tsx
+1
-1
index.less
src/layouts/default/tabs/index.less
+1
-1
charts.ts
src/router/routes/modules/demo/charts.ts
+1
-1
Login.vue
src/views/sys/login/Login.vue
+4
-0
No files found.
CHANGELOG.zh_CN.md
View file @
ee1c3498
...
...
@@ -3,6 +3,7 @@
### 🐛 Bug Fixes
-
登录页样式修复
-
修复菜单已知问题
## 2.2.0 (2021-04-06)
...
...
src/components/Application/src/AppDarkModeToggle.vue
View file @
ee1c3498
...
...
@@ -3,7 +3,6 @@
v-if=
"getShowDarkModeToggle"
:class=
"[
prefixCls,
`$
{prefixCls}--${size}`,
{
[`${prefixCls}--dark`]: isDark,
},
...
...
@@ -30,13 +29,13 @@
export
default
defineComponent
({
name
:
'
DarkModeToggle
'
,
components
:
{
SvgIcon
},
props
:
{
size
:
{
type
:
String
,
default
:
'
default
'
,
validate
:
(
val
)
=>
[
'
default
'
,
'
large
'
].
includes
(
val
),
},
},
//
props: {
//
size: {
//
type: String,
//
default: 'default',
//
validate: (val) => ['default', 'large'].includes(val),
//
},
//
},
setup
()
{
const
{
prefixCls
}
=
useDesign
(
'
dark-mode-toggle
'
);
const
{
getDarkMode
,
setDarkMode
,
getShowDarkModeToggle
}
=
useRootSetting
();
...
...
@@ -97,15 +96,15 @@
}
}
&--large {
width: 72
px;
height: 34px;
padding: 0 10px;
//
&--large {
// width: 70
px;
//
height: 34px;
//
padding: 0 10px;
.@{prefix-cls}-inner {
width: 26px;
height: 26px;
}
}
//
.@{prefix-cls}-inner {
//
width: 26px;
//
height: 26px;
//
}
//
}
}
</
style
>
src/components/Icon/src/index.vue
View file @
ee1c3498
...
...
@@ -24,8 +24,6 @@
import
Iconify
from
'
@purge-icons/generated
'
;
import
{
isString
}
from
'
/@/utils/is
'
;
import
{
propTypes
}
from
'
/@/utils/propTypes
'
;
import
{
useRootSetting
}
from
'
/@/hooks/setting/useRootSetting
'
;
import
{
ThemeEnum
}
from
'
/@/enums/appEnum
'
;
const
SVG_END_WITH_FLAG
=
'
|svg
'
;
export
default
defineComponent
({
...
...
@@ -46,8 +44,6 @@
setup
(
props
)
{
const
elRef
=
ref
<
ElRef
>
(
null
);
const
{
getDarkMode
}
=
useRootSetting
();
const
isSvgIcon
=
computed
(()
=>
props
.
icon
?.
endsWith
(
SVG_END_WITH_FLAG
));
const
getSvgIcon
=
computed
(()
=>
props
.
icon
.
replace
(
SVG_END_WITH_FLAG
,
''
));
const
getIconRef
=
computed
(()
=>
`
${
props
.
prefix
?
props
.
prefix
+
'
:
'
:
''
}${
props
.
icon
}
`
);
...
...
@@ -85,7 +81,7 @@
return
{
fontSize
:
`
${
fs
}
px`
,
color
:
color
||
(
unref
(
getDarkMode
)
===
ThemeEnum
.
DARK
?
'
#fff
'
:
'
#303133
'
)
,
color
:
color
,
display
:
'
inline-flex
'
,
};
}
...
...
src/components/SimpleMenu/src/SimpleMenu.vue
View file @
ee1c3498
<
template
>
<Menu
v-bind=
"getBindValues"
@
select=
"handleSelect"
:activeName=
"activeName"
:openNames=
"getOpenKeys"
:class=
"prefixCls"
:activeSubMenuNames=
"activeSubMenuNames"
@
select=
"handleSelect"
@
open-change=
"handleOpenChange"
>
<template
v-for=
"item in items"
:key=
"item.path"
>
<SimpleSubMenu
...
...
@@ -53,6 +54,7 @@
beforeClickFn
:
{
type
:
Function
as
PropType
<
(
key
:
string
)
=>
Promise
<
boolean
>>
,
},
isSplitMenu
:
propTypes
.
bool
,
},
emits
:
[
'
menuClick
'
],
setup
(
props
,
{
attrs
,
emit
})
{
...
...
@@ -94,6 +96,9 @@
watch
(
()
=>
props
.
items
,
()
=>
{
if
(
!
props
.
isSplitMenu
)
{
return
;
}
setOpenKeys
(
currentRoute
.
value
.
path
);
},
{
flush
:
'
post
'
}
...
...
@@ -135,11 +140,17 @@
menuState
.
activeName
=
key
;
}
function
handleOpenChange
(
v
)
{
console
.
log
(
'
======================
'
);
console
.
log
(
v
);
console
.
log
(
'
======================
'
);
}
return
{
prefixCls
,
getBindValues
,
handleSelect
,
getOpenKeys
,
handleOpenChange
,
...
toRefs
(
menuState
),
};
},
...
...
src/components/SimpleMenu/src/components/Menu.vue
View file @
ee1c3498
...
...
@@ -138,6 +138,15 @@
});
emit('select', name);
});
rootMenuEmitter.on('open-name-change', ({ name, opened }) => {
if (opened && !openedNames.value.includes(name)) {
openedNames.value.push(name);
} else if (!opened) {
const index = openedNames.value.findIndex((item) => item === name);
index !== -1 && openedNames.value.splice(index, 1);
}
});
});
return { getClass, openedNames };
...
...
src/components/SimpleMenu/src/components/MenuItem.vue
View file @
ee1c3498
...
...
@@ -66,11 +66,16 @@
function
handleClickItem
()
{
const
{
disabled
}
=
props
;
if
(
disabled
)
return
;
if
(
disabled
)
{
return
;
}
rootMenuEmitter
.
emit
(
'
on-menu-item-select
'
,
props
.
name
);
if
(
unref
(
getCollapse
))
return
;
if
(
unref
(
getCollapse
))
{
return
;
}
const
{
uidList
}
=
getParentList
();
rootMenuEmitter
.
emit
(
'
on-update-opened
'
,
{
opend
:
false
,
parent
:
instance
?.
parent
,
...
...
src/components/SimpleMenu/src/components/SubMenuItem.vue
View file @
ee1c3498
...
...
@@ -43,8 +43,9 @@
:class=
"`${prefixCls}-submenu-title-icon`"
/>
</div>
<
template
#content
>
<div
v-bind=
"getEvents(true)"
v-show=
"opened"
>
<!-- eslint-disable-next-line -->
<
template
#content
v-show=
"opened"
>
<div
v-bind=
"getEvents(true)"
>
<ul
:class=
"[prefixCls, `$
{prefixCls}-${getTheme}`, `${prefixCls}-popup`]">
<slot></slot>
</ul>
...
...
@@ -78,7 +79,7 @@
import
{
isBoolean
,
isObject
}
from
'
/@/utils/is
'
;
import
Mitt
from
'
/@/utils/mitt
'
;
const
DELAY
=
2
5
0
;
const
DELAY
=
2
0
0
;
export
default
defineComponent
({
name
:
'
SubMenu
'
,
components
:
{
...
...
@@ -189,6 +190,7 @@
const { disabled } = props;
if (disabled || unref(getCollapse)) return;
const opened = state.opened;
if (unref(getAccordion)) {
const { uidList } = getParentList();
rootMenuEmitter.emit('on-update-opened', {
...
...
@@ -196,6 +198,11 @@
parent: instance?.parent,
uidList: uidList,
});
} else {
rootMenuEmitter.emit('open-name-change', {
name: props.name,
opened: !opened,
});
}
state.opened = !opened;
}
...
...
src/components/SimpleMenu/src/useOpenKeys.ts
View file @
ee1c3498
...
...
@@ -8,7 +8,7 @@ import { uniq } from 'lodash-es';
import
{
getAllParentPath
}
from
'
/@/router/helper/menuHelper
'
;
import
{
useTimeoutFn
}
from
'
/@/hooks/core/useTimeout
'
;
import
{
useDebounce
}
from
'
../../..
/hooks/core/useDebounce
'
;
import
{
useDebounce
}
from
'
/@
/hooks/core/useDebounce
'
;
export
function
useOpenKeys
(
menuState
:
MenuState
,
...
...
src/layouts/default/menu/index.vue
View file @
ee1c3498
...
...
@@ -49,6 +49,7 @@
getAccordion
,
getIsHorizontal
,
getIsSidebarType
,
getSplit
,
}
=
useMenuSetting
();
const
{
getShowLogo
}
=
useRootSetting
();
...
...
@@ -144,7 +145,7 @@
// console.log(menus);
if
(
!
menus
||
!
menus
.
length
)
return
null
;
return
!
props
.
isHorizontal
?
(
<
SimpleMenu
{...
menuProps
}
items
=
{
menus
}
/
>
<
SimpleMenu
{...
menuProps
}
i
sSplitMenu
=
{
unref
(
getSplit
)}
i
tems
=
{
menus
}
/
>
)
:
(
<
BasicMenu
{...
menuProps
}
...
...
src/layouts/default/setting/SettingDrawer.tsx
View file @
ee1c3498
...
...
@@ -408,7 +408,7 @@ export default defineComponent({
wrapClassName=
"setting-drawer"
>
{
unref
(
getShowDarkModeToggle
)
&&
<
Divider
>
{
()
=>
t
(
'
layout.setting.darkMode
'
)
}
</
Divider
>
}
{
unref
(
getShowDarkModeToggle
)
&&
<
AppDarkModeToggle
class=
"mx-auto"
size=
"large"
/>
}
{
unref
(
getShowDarkModeToggle
)
&&
<
AppDarkModeToggle
class=
"mx-auto"
/>
}
<
Divider
>
{
()
=>
t
(
'
layout.setting.navMode
'
)
}
</
Divider
>
{
renderSidebar
()
}
<
Divider
>
{
()
=>
t
(
'
layout.setting.sysTheme
'
)
}
</
Divider
>
...
...
src/layouts/default/tabs/index.less
View file @
ee1c3498
...
...
@@ -82,7 +82,7 @@ html[data-theme='dark'] {
.ant-tabs-tab-active {
position: relative;
padding-left: 18px;
color: @white;
color: @white
!important
;
background: @primary-color;
border: 0;
transition: none;
...
...
src/router/routes/modules/demo/charts.ts
View file @
ee1c3498
...
...
@@ -7,7 +7,7 @@ const charts: AppRouteModule = {
path
:
'
/charts
'
,
name
:
'
Charts
'
,
component
:
LAYOUT
,
redirect
:
'
/charts/
apexChart
'
,
redirect
:
'
/charts/
echarts/map
'
,
meta
:
{
icon
:
'
ion:bar-chart-outline
'
,
title
:
t
(
'
routes.demo.charts.charts
'
),
...
...
src/views/sys/login/Login.vue
View file @
ee1c3498
...
...
@@ -112,6 +112,10 @@
&-form {
background: transparent !important;
}
.app-iconify {
color: #fff;
}
}
}
...
...
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