Skip to content

Commit 2c6952f

Browse files
陈鑫陈鑫
authored andcommitted
代码优化
1 parent 86c292f commit 2c6952f

File tree

4 files changed

+68
-2
lines changed

4 files changed

+68
-2
lines changed

src/assets/user.png

1.53 KB
Loading

src/components/GlobalHeader/Menus.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ const Menus = defineComponent({
7171
if (!menu.children || !menu.children.length) {
7272
return (
7373
<Menu.Item key={menu.path}>
74+
{menus.meta?.icon && (
75+
<span
76+
class={`iconfont ${menu.meta.icon} menu-icon`}
77+
></span>
78+
)}
7479
<span>{menu.meta?.title}</span>
7580
</Menu.Item>
7681
)

src/layouts/LevelBasicLayout.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
import { defineComponent } from 'vue'
22
import { RouterView } from 'vue-router'
3-
import { Layout } from 'ant-design-vue'
3+
import { Layout, Dropdown } from 'ant-design-vue'
44
import { GlobalHeader, Menus } from '@/components/GlobalHeader'
55

66
import styles from './index.module.less'
7+
import UserIcon from '../assets/user.png'
78

89
const LevelBasicLayout = defineComponent({
910
name: 'LevelBasicLayout',
1011
setup() {
1112
const slots = {
12-
content: () => <Menus></Menus>,
13+
content: () => (
14+
<>
15+
{/* 导航栏 */}
16+
<Menus></Menus>
17+
{/* 用户信息 */}
18+
<div class={styles['user-info']}>
19+
<Dropdown>
20+
<div>
21+
<img src={UserIcon} class={styles['user-head']} />
22+
<a class={styles['user-name']}>admin</a>
23+
</div>
24+
</Dropdown>
25+
</div>
26+
</>
27+
),
1328
}
1429
return () => (
1530
<Layout class={styles['level-layout']}>

src/layouts/index.module.less

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,52 @@
66
height: 100%;
77
}
88
}
9+
.user-info {
10+
min-width: 100px;
11+
display: flex;
12+
flex-flow: row nowrap;
13+
align-items: center;
14+
justify-content: flex-end;
15+
.lang-box {
16+
width: 80px;
17+
margin-right: 10px;
18+
&.ant-select {
19+
font-size: 12px;
20+
}
21+
.ant-select-selection {
22+
background: transparent;
23+
border: 1px solid #a7a5a5;
24+
color: #fff;
25+
}
26+
.ant-select-arrow {
27+
color: #fff;
28+
font-size: 10px;
29+
}
30+
}
31+
.ant-dropdown-trigger {
32+
height: 54px;
33+
line-height: 54px;
34+
}
35+
.user-head {
36+
width: 30px;
37+
height: 30px;
38+
margin-right: 10px;
39+
margin-top: -4px;
40+
}
41+
.user-name {
42+
line-height: 54px;
43+
font-size: 16px;
44+
color: rgba(255, 255, 255, 0.85);
45+
}
46+
.icon {
47+
line-height: 54px;
48+
font-size: 24px;
49+
font-weight: bold;
50+
color: #fff;
51+
margin-left: 10px;
52+
cursor: pointer;
53+
}
54+
}
955
}
1056

1157
.page-view {

0 commit comments

Comments
 (0)