Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
f69aaeab
提交
f69aaeab
authored
12月 22, 2020
作者:
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: fix layout style
上级
bd7b53f1
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
123 行增加
和
10 行删除
+123
-10
AppLogo.vue
src/components/Application/src/AppLogo.vue
+11
-1
BasicMenu.vue
src/components/Menu/src/BasicMenu.vue
+6
-2
index.less
src/components/Menu/src/index.less
+71
-0
props.ts
src/components/Menu/src/props.ts
+1
-1
useMenuSetting.ts
src/hooks/setting/useMenuSetting.ts
+5
-1
index.vue
src/layouts/default/index.vue
+5
-1
index.tsx
src/layouts/default/menu/index.tsx
+3
-0
SettingDrawer.tsx
src/layouts/default/setting/SettingDrawer.tsx
+7
-0
handler.ts
src/layouts/default/setting/handler.ts
+5
-1
MixSider.vue
src/layouts/default/sider/MixSider.vue
+4
-3
setting.ts
src/locales/lang/en/layout/setting.ts
+1
-0
setting.ts
src/locales/lang/zh_CN/layout/setting.ts
+1
-0
projectSetting.ts
src/settings/projectSetting.ts
+2
-0
config.d.ts
src/types/config.d.ts
+1
-0
没有找到文件。
src/components/Application/src/AppLogo.vue
浏览文件 @
f69aaeab
...
@@ -3,7 +3,11 @@
...
@@ -3,7 +3,11 @@
* @Description: logo component
* @Description: logo component
-->
-->
<
template
>
<
template
>
<div
class=
"anticon"
:class=
"[prefixCls, theme]"
@
click=
"handleGoHome"
>
<div
class=
"anticon"
:class=
"[prefixCls, theme,
{ 'collapsed-show-title': getCollapsedShowTitle }]"
@click="handleGoHome"
>
<img
src=
"/@/assets/images/logo.png"
/>
<img
src=
"/@/assets/images/logo.png"
/>
<div
class=
"ml-2 ellipsis"
:class=
"[`$
{prefixCls}__title`]" v-show="showTitle">
<div
class=
"ml-2 ellipsis"
:class=
"[`$
{prefixCls}__title`]" v-show="showTitle">
{{
title
}}
{{
title
}}
...
@@ -35,6 +39,7 @@
...
@@ -35,6 +39,7 @@
},
},
setup
()
{
setup
()
{
const
{
prefixCls
}
=
useDesign
(
'app-logo'
);
const
{
prefixCls
}
=
useDesign
(
'app-logo'
);
const
{
getCollapsedShowTitle
}
=
useMenuSetting
();
const
{
title
}
=
useGlobSetting
();
const
{
title
}
=
useGlobSetting
();
...
@@ -48,6 +53,7 @@
...
@@ -48,6 +53,7 @@
handleGoHome
,
handleGoHome
,
title
,
title
,
prefixCls
,
prefixCls
,
getCollapsedShowTitle
,
};
};
},
},
});
});
...
@@ -67,6 +73,10 @@
...
@@ -67,6 +73,10 @@
border-bottom
:
1px
solid
@
border-color-base
;
border-bottom
:
1px
solid
@
border-color-base
;
}
}
&
.collapsed-show-title
{
padding-left
:
20px
;
}
&
.light
&
__title
{
&
.light
&
__title
{
color
:
@
primary-color
;
color
:
@
primary-color
;
}
}
...
...
src/components/Menu/src/BasicMenu.vue
浏览文件 @
f69aaeab
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
:item=
"item"
:item=
"item"
:theme=
"theme"
:theme=
"theme"
:level=
"1"
:level=
"1"
:showTitle=
"
!getCollapsed
"
:showTitle=
"
showTitle
"
:isHorizontal=
"isHorizontal"
:isHorizontal=
"isHorizontal"
/>
/>
</
template
>
</
template
>
...
@@ -95,12 +95,16 @@
...
@@ -95,12 +95,16 @@
prefixCls
,
prefixCls
,
`justify-
${
align
}
`
,
`justify-
${
align
}
`
,
{
{
[
`
${
prefixCls
}
--hide-title`
]:
!
unref
(
showTitle
),
[
`
${
prefixCls
}
--collapsed-show-title`
]:
props
.
collapsedShowTitle
,
[
`
${
prefixCls
}
__second`
]:
!
props
.
isHorizontal
&&
unref
(
getSplit
),
[
`
${
prefixCls
}
__second`
]:
!
props
.
isHorizontal
&&
unref
(
getSplit
),
[
`
${
prefixCls
}
__sidebar-hor`
]:
unref
(
getIsTopMenu
),
[
`
${
prefixCls
}
__sidebar-hor`
]:
unref
(
getIsTopMenu
),
},
},
];
];
});
});
const
showTitle
=
computed
(()
=>
props
.
collapsedShowTitle
&&
unref
(
getCollapsed
));
const
getInlineCollapseOptions
=
computed
(()
=>
{
const
getInlineCollapseOptions
=
computed
(()
=>
{
const
isInline
=
props
.
mode
===
MenuModeEnum
.
INLINE
;
const
isInline
=
props
.
mode
===
MenuModeEnum
.
INLINE
;
...
@@ -164,7 +168,7 @@
...
@@ -164,7 +168,7 @@
getMenuClass
,
getMenuClass
,
handleOpenChange
,
handleOpenChange
,
getOpenKeys
,
getOpenKeys
,
getCollapsed
,
showTitle
,
...
toRefs
(
menuState
),
...
toRefs
(
menuState
),
};
};
},
},
...
...
src/components/Menu/src/index.less
浏览文件 @
f69aaeab
...
@@ -48,6 +48,63 @@
...
@@ -48,6 +48,63 @@
opacity: 1 !important;
opacity: 1 !important;
}
}
&--hide-title {
&.ant-menu-inline-collapsed > .ant-menu-item,
&.ant-menu-inline-collapsed > .ant-menu-item-group > .ant-menu-item-group-list > .ant-menu-item,
&.ant-menu-inline-collapsed
> .ant-menu-item-group
> .ant-menu-item-group-list
> .ant-menu-submenu
> .ant-menu-submenu-title,
&.ant-menu-inline-collapsed .ant-menu-submenu-title {
padding-right: 16px !important;
padding-left: 16px !important;
}
}
&--collapsed-show-title.ant-menu-inline-collapsed {
.@{basic-menu-prefix-cls}-item__level1 {
padding: 2px 0;
justify-content: center !important;
&.ant-menu-item {
display: flex;
align-items: center;
height: 60px !important;
margin-top: 0 !important;
margin-bottom: 0 !important;
line-height: 60px !important;
> span {
margin-top: 10px;
}
}
}
& > li[role='menuitem']:not(.ant-menu-submenu),
& > li > .ant-menu-submenu-title {
display: flex;
margin-top: 10px;
font-size: 12px;
flex-direction: column;
align-items: center;
line-height: 24px;
}
& > li > .ant-menu-submenu-title {
line-height: 24px;
}
.@{basic-menu-content-prefix-cls}-wrapper {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
.@{basic-menu-content-prefix-cls}--show-title {
line-height: 30px;
}
}
}
&.ant-menu-inline-collapsed > .ant-menu-item,
&.ant-menu-inline-collapsed > .ant-menu-item,
&.ant-menu-inline-collapsed > .ant-menu-item-group > .ant-menu-item-group-list > .ant-menu-item,
&.ant-menu-inline-collapsed > .ant-menu-item-group > .ant-menu-item-group-list > .ant-menu-item,
&.ant-menu-inline-collapsed
&.ant-menu-inline-collapsed
...
@@ -62,6 +119,7 @@
...
@@ -62,6 +119,7 @@
.@{basic-menu-content-prefix-cls}-wrapper {
.@{basic-menu-content-prefix-cls}-wrapper {
width: 100%;
width: 100%;
margin-top: 4px;
&__icon {
&__icon {
vertical-align: text-top;
vertical-align: text-top;
...
@@ -181,7 +239,20 @@
...
@@ -181,7 +239,20 @@
&.ant-menu-inline-collapsed {
&.ant-menu-inline-collapsed {
.ant-menu-submenu-selected,
.ant-menu-submenu-selected,
.ant-menu-item-selected {
.ant-menu-item-selected {
position: relative;
font-weight: 500;
color: @white;
background: @sider-dark-darken-bg-color !important;
background: @sider-dark-darken-bg-color !important;
&::before {
position: absolute;
top: 0;
left: 0;
width: 3px;
height: 100%;
background: @primary-color;
content: '';
}
}
}
}
}
}
}
...
...
src/components/Menu/src/props.ts
浏览文件 @
f69aaeab
...
@@ -9,7 +9,7 @@ export const basicProps = {
...
@@ -9,7 +9,7 @@ export const basicProps = {
type
:
Array
as
PropType
<
Menu
[]
>
,
type
:
Array
as
PropType
<
Menu
[]
>
,
default
:
()
=>
[],
default
:
()
=>
[],
},
},
collapsedShowTitle
:
propTypes
.
bool
,
// 最好是4 倍数
// 最好是4 倍数
inlineIndent
:
propTypes
.
number
.
def
(
20
),
inlineIndent
:
propTypes
.
number
.
def
(
20
),
// 菜单组件的mode属性
// 菜单组件的mode属性
...
...
src/hooks/setting/useMenuSetting.ts
浏览文件 @
f69aaeab
...
@@ -45,6 +45,8 @@ const getIsSidebarType = computed(() => unref(getMenuType) === MenuTypeEnum.SIDE
...
@@ -45,6 +45,8 @@ const getIsSidebarType = computed(() => unref(getMenuType) === MenuTypeEnum.SIDE
const
getIsTopMenu
=
computed
(()
=>
unref
(
getMenuType
)
===
MenuTypeEnum
.
TOP_MENU
);
const
getIsTopMenu
=
computed
(()
=>
unref
(
getMenuType
)
===
MenuTypeEnum
.
TOP_MENU
);
const
getCollapsedShowTitle
=
computed
(()
=>
unref
(
getMenuSetting
).
collapsedShowTitle
);
const
getShowTopMenu
=
computed
(()
=>
{
const
getShowTopMenu
=
computed
(()
=>
{
return
unref
(
getMenuMode
)
===
MenuModeEnum
.
HORIZONTAL
||
unref
(
getSplit
);
return
unref
(
getMenuMode
)
===
MenuModeEnum
.
HORIZONTAL
||
unref
(
getSplit
);
});
});
...
@@ -74,7 +76,8 @@ const getRealWidth = computed(() => {
...
@@ -74,7 +76,8 @@ const getRealWidth = computed(() => {
});
});
const
getMiniWidthNumber
=
computed
(()
=>
{
const
getMiniWidthNumber
=
computed
(()
=>
{
return
SIDE_BAR_MINI_WIDTH
;
const
{
collapsedShowTitle
}
=
unref
(
getMenuSetting
);
return
collapsedShowTitle
?
SIDE_BAR_SHOW_TIT_MINI_WIDTH
:
SIDE_BAR_MINI_WIDTH
;
});
});
const
getCalcContentWidth
=
computed
(()
=>
{
const
getCalcContentWidth
=
computed
(()
=>
{
...
@@ -128,6 +131,7 @@ export function useMenuSetting() {
...
@@ -128,6 +131,7 @@ export function useMenuSetting() {
getSplit
,
getSplit
,
getMenuTheme
,
getMenuTheme
,
getCanDrag
,
getCanDrag
,
getCollapsedShowTitle
,
getIsHorizontal
,
getIsHorizontal
,
getIsSidebarType
,
getIsSidebarType
,
getAccordion
,
getAccordion
,
...
...
src/layouts/default/index.vue
浏览文件 @
f69aaeab
...
@@ -2,7 +2,11 @@
...
@@ -2,7 +2,11 @@
<Layout
:class=
"prefixCls"
>
<Layout
:class=
"prefixCls"
>
<LayoutFeatures
/>
<LayoutFeatures
/>
<LayoutHeader
fixed
v-if=
"getShowFullHeaderRef"
/>
<LayoutHeader
fixed
v-if=
"getShowFullHeaderRef"
/>
<Layout
class=
"ant-layout-has-sider"
>
<Layout
:class=
"
{
'ant-layout-has-sider': getIsMixSidebar,
}"
>
<LayoutSideBar
v-if=
"getShowSidebar || getIsMobile"
/>
<LayoutSideBar
v-if=
"getShowSidebar || getIsMobile"
/>
<Layout
:class=
"`$
{prefixCls}__main`">
<Layout
:class=
"`$
{prefixCls}__main`">
<LayoutMultipleHeader
/>
<LayoutMultipleHeader
/>
...
...
src/layouts/default/menu/index.tsx
浏览文件 @
f69aaeab
...
@@ -45,6 +45,7 @@ export default defineComponent({
...
@@ -45,6 +45,7 @@ export default defineComponent({
getMenuType
,
getMenuType
,
getMenuTheme
,
getMenuTheme
,
getCollapsed
,
getCollapsed
,
getCollapsedShowTitle
,
getAccordion
,
getAccordion
,
getIsHorizontal
,
getIsHorizontal
,
getIsSidebarType
,
getIsSidebarType
,
...
@@ -130,6 +131,8 @@ export default defineComponent({
...
@@ -130,6 +131,8 @@ export default defineComponent({
beforeClickFn=
{
beforeMenuClickFn
}
beforeClickFn=
{
beforeMenuClickFn
}
isHorizontal=
{
props
.
isHorizontal
}
isHorizontal=
{
props
.
isHorizontal
}
type=
{
unref
(
getMenuType
)
}
type=
{
unref
(
getMenuType
)
}
collapsedShowTitle=
{
unref
(
getCollapsedShowTitle
)
}
showLogo=
{
unref
(
getIsShowLogo
)
}
mode=
{
unref
(
getComputedMenuMode
)
}
mode=
{
unref
(
getComputedMenuMode
)
}
theme=
{
unref
(
getComputedMenuTheme
)
}
theme=
{
unref
(
getComputedMenuTheme
)
}
items=
{
unref
(
menusRef
)
}
items=
{
unref
(
menusRef
)
}
...
...
src/layouts/default/setting/SettingDrawer.tsx
浏览文件 @
f69aaeab
...
@@ -61,6 +61,7 @@ export default defineComponent({
...
@@ -61,6 +61,7 @@ export default defineComponent({
getShowMenu
,
getShowMenu
,
getMenuType
,
getMenuType
,
getTrigger
,
getTrigger
,
getCollapsedShowTitle
,
getMenuFixed
,
getMenuFixed
,
getCollapsed
,
getCollapsed
,
getCanDrag
,
getCanDrag
,
...
@@ -176,6 +177,12 @@ export default defineComponent({
...
@@ -176,6 +177,12 @@ export default defineComponent({
def=
{
unref
(
getCollapsed
)
}
def=
{
unref
(
getCollapsed
)
}
disabled=
{
!
unref
(
getShowMenuRef
)
||
unref
(
getIsMixSidebar
)
}
disabled=
{
!
unref
(
getShowMenuRef
)
||
unref
(
getIsMixSidebar
)
}
/>
/>
<
SwitchItem
title=
{
t
(
'layout.setting.collapseMenuDisplayName'
)
}
event=
{
HandlerEnum
.
MENU_COLLAPSED_SHOW_TITLE
}
def=
{
unref
(
getCollapsedShowTitle
)
}
disabled=
{
!
unref
(
getShowMenuRef
)
||
!
unref
(
getCollapsed
)
}
/>
<
SwitchItem
<
SwitchItem
title=
{
t
(
'layout.setting.fixedHeader'
)
}
title=
{
t
(
'layout.setting.fixedHeader'
)
}
...
...
src/layouts/default/setting/handler.ts
浏览文件 @
f69aaeab
...
@@ -51,12 +51,16 @@ export function handler(event: HandlerEnum, value: any): DeepPartial<ProjectConf
...
@@ -51,12 +51,16 @@ export function handler(event: HandlerEnum, value: any): DeepPartial<ProjectConf
case
HandlerEnum
.
MENU_SHOW_SIDEBAR
:
case
HandlerEnum
.
MENU_SHOW_SIDEBAR
:
return
{
menuSetting
:
{
show
:
value
}
};
return
{
menuSetting
:
{
show
:
value
}
};
case
HandlerEnum
.
MENU_COLLAPSED_SHOW_TITLE
:
return
{
menuSetting
:
{
collapsedShowTitle
:
value
}
};
case
HandlerEnum
.
MENU_THEME
:
case
HandlerEnum
.
MENU_THEME
:
updateSidebarBgColor
(
value
);
updateSidebarBgColor
(
value
);
return
{
menuSetting
:
{
bgColor
:
value
}
};
return
{
menuSetting
:
{
bgColor
:
value
}
};
case
HandlerEnum
.
MENU_SPLIT
:
case
HandlerEnum
.
MENU_SPLIT
:
return
{
menuSetting
:
{
split
:
value
}
};
return
{
menuSetting
:
{
split
:
value
,
collapsedShowTitle
:
true
}
};
case
HandlerEnum
.
MENU_CLOSE_MIX_SIDEBAR_ON_CHANGE
:
case
HandlerEnum
.
MENU_CLOSE_MIX_SIDEBAR_ON_CHANGE
:
return
{
menuSetting
:
{
closeMixSidebarOnChange
:
value
}
};
return
{
menuSetting
:
{
closeMixSidebarOnChange
:
value
}
};
...
...
src/layouts/default/sider/MixSider.vue
浏览文件 @
f69aaeab
...
@@ -267,15 +267,16 @@
...
@@ -267,15 +267,16 @@
}
}
}
}
}
}
@border-color
:
@
sider-dark-lighten-1-bg-color
;
&
.dark
{
&
.dark
{
&.open
{
&.open
{
.@{prefix-cls
}
-logo
{
.@{prefix-cls
}
-logo
{
border-bottom
:
1px
solid
rgb
(
114
114
114
)
;
border-bottom
:
1px
solid
@
border-color
;
}
}
>
.scroll-container
{
>
.scroll-container
{
border-right
:
1px
solid
rgb
(
114
114
114
)
;
border-right
:
1px
solid
@
border-color
;
}
}
}
}
.@
{
prefix-cls
}
-menu-list
{
.@
{
prefix-cls
}
-menu-list
{
...
@@ -284,7 +285,7 @@
...
@@ -284,7 +285,7 @@
&__title
{
&__title
{
color
:
@
white
;
color
:
@
white
;
border-bottom
:
none
;
border-bottom
:
none
;
border-bottom
:
1px
solid
rgb
(
114
114
114
)
;
border-bottom
:
1px
solid
@
border-color
;
}
}
}
}
}
}
...
...
src/locales/lang/en/layout/setting.ts
浏览文件 @
f69aaeab
...
@@ -45,6 +45,7 @@ export default {
...
@@ -45,6 +45,7 @@ export default {
menuSearch
:
'Menu search'
,
menuSearch
:
'Menu search'
,
menuAccordion
:
'Sidebar accordion'
,
menuAccordion
:
'Sidebar accordion'
,
menuCollapse
:
'Collapse menu'
,
menuCollapse
:
'Collapse menu'
,
collapseMenuDisplayName
:
'Collapse menu display name'
,
topMenuLayout
:
'Top menu layout'
,
topMenuLayout
:
'Top menu layout'
,
menuCollapseButton
:
'Menu collapse button'
,
menuCollapseButton
:
'Menu collapse button'
,
contentMode
:
'Content area width'
,
contentMode
:
'Content area width'
,
...
...
src/locales/lang/zh_CN/layout/setting.ts
浏览文件 @
f69aaeab
...
@@ -44,6 +44,7 @@ export default {
...
@@ -44,6 +44,7 @@ export default {
menuSearch
:
'菜单搜索'
,
menuSearch
:
'菜单搜索'
,
menuAccordion
:
'侧边菜单手风琴模式'
,
menuAccordion
:
'侧边菜单手风琴模式'
,
menuCollapse
:
'折叠菜单'
,
menuCollapse
:
'折叠菜单'
,
collapseMenuDisplayName
:
'折叠菜单显示名称'
,
topMenuLayout
:
'顶部菜单布局'
,
topMenuLayout
:
'顶部菜单布局'
,
menuCollapseButton
:
'菜单折叠按钮'
,
menuCollapseButton
:
'菜单折叠按钮'
,
contentMode
:
'内容区域宽度'
,
contentMode
:
'内容区域宽度'
,
...
...
src/settings/projectSetting.ts
浏览文件 @
f69aaeab
...
@@ -81,6 +81,8 @@ const setting: ProjectConfig = {
...
@@ -81,6 +81,8 @@ const setting: ProjectConfig = {
fixed
:
true
,
fixed
:
true
,
// Menu collapse
// Menu collapse
collapsed
:
false
,
collapsed
:
false
,
// Whether to display the menu name when folding the menu
collapsedShowTitle
:
false
,
// Whether it can be dragged
// Whether it can be dragged
// Only limited to the opening of the left menu, the mouse has a drag bar on the right side of the menu
// Only limited to the opening of the left menu, the mouse has a drag bar on the right side of the menu
canDrag
:
true
,
canDrag
:
true
,
...
...
src/types/config.d.ts
浏览文件 @
f69aaeab
...
@@ -19,6 +19,7 @@ export interface MenuSetting {
...
@@ -19,6 +19,7 @@ export interface MenuSetting {
trigger
:
TriggerEnum
;
trigger
:
TriggerEnum
;
accordion
:
boolean
;
accordion
:
boolean
;
closeMixSidebarOnChange
:
boolean
;
closeMixSidebarOnChange
:
boolean
;
collapsedShowTitle
:
boolean
;
}
}
export
interface
MultiTabsSetting
{
export
interface
MultiTabsSetting
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论