头部背景图片
小畅童鞋的学习笔记 |
小畅童鞋的学习笔记 |

使用flex布局来搭建基本的页面布局

我们的目的是为了实现这样的布局:
Image1.png

源码实现:
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
<template>
<h-page-container>
<div class="container">
<div class="main">
<div class="header">
<p>标题栏</p>
</div>
<div class="content">
<div class="left">
<p>左侧栏</p>
</div>
<div class="box">
<div class="column">
<div class="item">
<p>内容一</p>
</div>
<div class="item">
<p>内容二</p>
</div>
</div>
<div class="column">
<div class="item">
<p>内容三</p>
</div>
<div class="item">
<p>内容四</p>
</div>
</div>
</div>
</div>
</div>
<div class="right">
<p>右侧栏</p>
</div>
</div>
</h-page-container>
</template>

<style lang="less" scoped>
.container {
display: flex;
display: -webkit-flex; /* Safari */
height: 600px;
flex: 1
}
.main {
flex: 6;
border: 2px solid red;
display: flex;
display: -webkit-flex; /* Safari */
flex-direction: column
}
.right {
flex: 2;
border: 2px solid red
}
.header {
flex: 1;
border: 2px solid red
}
.content {
flex: 9;
border: 2px solid red;
display: flex;
display: -webkit-flex /* Safari */
}
.left {
flex: 2;
border: 2px solid red
}
.box {
flex: 8;
border: 2px solid red;
display: flex;
display: -webkit-flex /* Safari */
}
.column {
flex: 1;
border: 2px solid red;
display: flex;
display: -webkit-flex; /* Safari */
flex-direction: column
}
.item {
flex: 1;
border: 2px solid red;
display: flex;
display: -webkit-flex /* Safari */
}
</style>

<script>
import EchartsPie from '@/components/EchartsPie.vue'
export default {
name: 'Recognition',
props: {
breadcrumbObj: {
type: Object,
default: () => null
}
},
components: {
EchartsPie
}
}
</script>
结果展示:

Image1.png
接下来就可以插入各种组件来填充我们的页面了
例如,把上上上篇博客刚刚讲完用Echarts构建的饼图组件放入页面中!
Image2.png

Lililich's Blog