-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathLayout.vue
More file actions
157 lines (140 loc) · 4.18 KB
/
Layout.vue
File metadata and controls
157 lines (140 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<template>
<a-layout class="layout-demo">
<a-layout-sider collapsible breakpoint="xl">
<div class="logo"/>
<a-menu
:default-open-keys="['1']"
:default-selected-keys="['1']"
:style="{ width: '100%' }"
@menu-item-click="onClickMenuItem"
>
<router-link
v-for="(item, index) in menuItems"
:key="index"
:to="item.route"
class="menu-item"
>
<a-menu-item :key="item.id">
<IconHome></IconHome>
{{ item.name }}
</a-menu-item>
</router-link>
</a-menu>
<!-- trigger -->
<template #trigger="{ collapsed }">
<IconCaretRight v-if="collapsed"></IconCaretRight>
<IconCaretLeft v-else></IconCaretLeft>
</template>
</a-layout-sider>
<a-layout>
<!-- 头部区域 -->
<a-layout-header style="padding-left: 20px;">
<Header/> <!-- 引入头部组件 -->
</a-layout-header>
<a-layout style="padding: 0 24px;">
<!-- 内容上方面包屑-->
<!-- <a-breadcrumb :style="{ margin: '16px 0' }">-->
<!-- <a-breadcrumb-item>Home</a-breadcrumb-item>-->
<!-- <a-breadcrumb-item>List</a-breadcrumb-item>-->
<!-- <a-breadcrumb-item>App</a-breadcrumb-item>-->
<!-- </a-breadcrumb>-->
<!-- <!– 内容区域 –>-->
<!-- <a-layout-content class="content">-->
<!-- <slot></slot> <!– 插槽,用于插入页面内容 –>-->
<!-- </a-layout-content>-->
<slot></slot> <!-- 插槽,用于插入页面内容 -->
<!-- 底部区域 -->
<a-layout-footer>
<Footer/>
</a-layout-footer>
</a-layout>
</a-layout>
</a-layout>
</template>
<script>
import {defineComponent} from 'vue';
import {Message} from '@arco-design/web-vue';
import {
IconCaretRight,
IconCaretLeft,
IconHome,
IconCalendar,
} from '@arco-design/web-vue/es/icon';
import Header from './Header.vue'; // 引入头部组件
import Footer from './Footer.vue'; // 引入底部组件
export default defineComponent({
components: {
IconCaretRight,
IconCaretLeft,
IconHome,
IconCalendar,
Header,
Footer,
},
data() {
return {
menuItems: [
{id: 1, name: '主页', icon: 'pi pi-video', route: '/'},
{id: 2, name: '点播', icon: 'pi pi-video', route: '/video'},
{id: 3, name: '直播', icon: 'pi pi-video', route: '/live'},
{id: 4, name: '收藏', icon: 'pi pi-bookmark', route: '/collection'},
{id: 5, name: '历史', icon: 'pi pi-history', route: '/history'},
{id: 6, name: '设置', icon: 'pi pi-cog', route: '/settings'}
]
};
},
methods: {
onClickMenuItem(key) {
let _name = this.menuItems.find(it => it.id === key).name
let _content = `You select ${key},${_name}`
console.log(_content)
// Message.info({content: _content, showIcon: true});
}
}
});
</script>
<style scoped>
.layout-demo {
height: 98vh;
background: var(--color-fill-2);
border: 1px solid var(--color-border);
}
.layout-demo :deep(.arco-layout-sider) .logo {
height: 32px;
margin: 12px 8px;
background: rgba(255, 255, 255, 0.2);
}
.layout-demo :deep(.arco-layout-sider-light) .logo {
background: var(--color-fill-2);
}
.layout-demo :deep(.arco-layout-header) {
height: 64px;
line-height: 64px;
background: var(--color-bg-3);
}
.layout-demo :deep(.arco-layout-footer) {
height: 48px;
color: var(--color-text-2);
font-weight: 400;
font-size: 14px;
line-height: 48px;
}
.layout-demo :deep(.arco-layout-content) {
font-weight: 400;
font-size: 14px;
background: var(--color-bg-3);
padding-left: 15px;
padding-right: 15px;
overflow: auto; /* 允许内容区域滚动 */
max-height: calc(98vh - 64px - 48px - 60px); /* 去除头部、底部和面包屑后的可用空间 */
}
.layout-demo :deep(.arco-layout-footer),
.layout-demo :deep(.arco-layout-content) {
display: flex;
flex-direction: column;
justify-content: flex-start;
font-size: 16px;
font-stretch: condensed;
text-align: left;
}
</style>