Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
ee1c3498
提交
ee1c3498
authored
4月 08, 2021
作者:
Vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(menu): improve menu logic, fix #461
上级
780a8a67
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
66 行增加
和
33 行删除
+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
没有找到文件。
CHANGELOG.zh_CN.md
浏览文件 @
ee1c3498
...
...
@@ -3,6 +3,7 @@
### 🐛 Bug Fixes
-
登录页样式修复
-
修复菜单已知问题
## 2.2.0 (2021-04-06)
...
...
src/components/Application/src/AppDarkModeToggle.vue
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
ee1c3498
...
...
@@ -82,7 +82,7 @@ html[data-theme='dark'] {
.
ant-tabs-tab-active
{
position:
relative
;
padding-left:
18
px
;
color:
@white
;
color:
@white
!important
;
background:
@primary-color
;
border:
0
;
transition:
none
;
...
...
src/router/routes/modules/demo/charts.ts
浏览文件 @
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
浏览文件 @
ee1c3498
...
...
@@ -112,6 +112,10 @@
&
-form
{
background
:
transparent
!important
;
}
.app-iconify
{
color
:
#fff
;
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论