基础样式
happylay 🐑 2020-12-24 代码片段样式
摘要: 基础样式 时间: 2020-12-24
# 重置全局样式
/* 全局样式表 */
html,
#app,
body {
height: 100%;
margin: 0;
padding: 0;
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# 导入全局样式
// 导入全局样式表
import "./assets/css/reset.css";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
Vue.use(ElementUI);
1
2
3
4
5
2
3
4
5
# 登录界面样式
<template>
<div class="login_parent">
<div class="login_box">
<!-- 头像区域 -->
<div class="img_box">
<img class="login_img" src="../assets/logo.png" alt="" />
</div>
<div class="login_form">
<!-- 登录表单区域 -->
<el-form label-width="0px">
<!-- 用户名 -->
<el-form-item>
<el-input prefix-icon="el-icon-user"></el-input>
</el-form-item>
<!-- 密码 -->
<el-form-item>
<el-input prefix-icon="el-icon-lock"></el-input>
</el-form-item>
<!-- 按钮区域 -->
<el-form-item class="login_btn">
<el-button type="primary">登录</el-button>
<el-button type="info">重置</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script>
export default {
name: "Login",
data() {
return {};
},
mounted() {},
methods: {},
};
</script>
<style lang="scss" scoped>
.login_parent {
background-color: #314963;
height: 100%;
.login_box {
height: 300px;
width: 450px;
position: absolute;
left: 50%;
bottom: 50%;
transform: translate(-50%, 50%);
background-color: white;
border-radius: 5px;
.img_box {
background-color: white;
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 50%;
height: 130px;
width: 130px;
border: 1px solid white;
padding: 10px;
// 阴影
box-shadow: 0 0 10px #ddd;
img {
height: 100%;
width: 100%;
border-radius: 50%;
background-color: #999;
}
}
.login_form {
position: absolute;
bottom: 0;
width: 100%;
padding: 0 20px;
// content-box,border和padding不计算入width之内
// border-box,border和padding计算入width之内
box-sizing: border-box;
}
.login_btn {
display: flex;
justify-content: flex-end;
}
}
}
</style>
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
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
# 后台界面样式
<template>
<div class="home_parent">
<el-container class="container_box">
<!-- 头部 -->
<el-header class="header_box">
<!-- 左侧区域 -->
<div class="left_box">
<img src="../assets/logo.png" alt="" />
<span>后台管理系统</span>
</div>
<!-- 右侧区域 -->
<div class="right_box">
<button>退出</button>
</div>
</el-header>
<el-container>
<!-- 侧边栏区域 -->
<el-aside class="aside_box" width="200px">
<!-- 菜单栏 -->
<div>
<el-menu
default-active="2"
background-color="#817bdf"
text-color="#fff"
active-text-color="#ffd04b"
:unique-opened="true"
>
<el-submenu index="1">
<template slot="title">
<i class="el-icon-location"></i>
<span>权限管理</span>
</template>
<el-menu-item index="1-1">
<i class="el-icon-menu"></i>
<span slot="title">角色列表</span>
</el-menu-item>
</el-submenu>
<el-submenu index="2">
<template slot="title">
<i class="el-icon-location"></i>
<span>权限管理</span>
</template>
<el-menu-item index="2-1">
<i class="el-icon-menu"></i>
<span slot="title">角色列表</span>
</el-menu-item>
</el-submenu>
</el-menu>
</div>
</el-aside>
<!-- 主体区域 -->
<el-main class="main_box">
<!-- 面包屑 -->
<div>
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/home' }">
首页
</el-breadcrumb-item>
<el-breadcrumb-item>权限管理</el-breadcrumb-item>
<el-breadcrumb-item>角色管理</el-breadcrumb-item>
</el-breadcrumb>
</div>
<!-- 表格 -->
<div>
<el-table :data="tableData" style="width: 100%">
<el-table-column label="日期" width="180">
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span style="margin-left: 10px">{{ scope.row.date }}</span>
</template>
</el-table-column>
<el-table-column label="姓名" width="180">
<template slot-scope="scope">
<el-popover trigger="hover" placement="top">
<p>姓名: {{ scope.row.name }}</p>
<p>住址: {{ scope.row.address }}</p>
<div slot="reference" class="name-wrapper">
<el-tag size="medium">{{ scope.row.name }}</el-tag>
</div>
</el-popover>
</template>
</el-table-column>
<el-table-column label="住址" width="280">
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span style="margin-left: 10px">{{ scope.row.address }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.$index, scope.row)"
>
编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页 -->
<div>
<el-pagination
:page-sizes="[100, 200, 300, 400]"
:page-size="100"
layout="total, sizes, prev, pager, next, jumper"
:total="400"
>
</el-pagination>
</div>
</el-main>
</el-container>
</el-container>
</div>
</template>
<script>
export default {
name: "Home",
data() {
return {
tableData: [
{
date: "2016-05-02",
name: "王小虎",
address: "上海市普陀区金沙江路 1518 弄",
},
{
date: "2016-05-04",
name: "王小虎",
address: "上海市普陀区金沙江路 1517 弄",
},
{
date: "2016-05-01",
name: "王小虎",
address: "上海市普陀区金沙江路 1519 弄",
},
{
date: "2016-05-03",
name: "王小虎",
address: "上海市普陀区金沙江路 1516 弄",
},
],
};
},
methods: {
handleEdit(index, row) {
console.log(index, row);
},
handleDelete(index, row) {
console.log(index, row);
},
},
};
</script>
<style lang="scss" scoped>
.home_parent {
height: 100%;
.container_box {
height: 100%;
.header_box {
background-color: white;
display: flex;
justify-content: space-between;
align-items: center;
.left_box {
display: flex;
justify-content: center;
align-items: center;
img {
box-sizing: border-box;
height: 50px;
width: 50px;
border-radius: 50%;
background-color: white;
padding: 5px;
margin-right: 10px;
}
span {
font-size: 18px;
color: #999;
}
}
.right_box {
button {
background-color: #817bdf;
color: white;
font-size: 20px;
// 内边框
border: none;
border-radius: 5px;
// 外边框(轮廓)
outline: none;
}
}
}
.main_box {
background-color: #eceff2;
div:nth-child(2) {
padding: 20px 0 10px 10px;
.el-table {
border-radius: 10px;
box-shadow: 10px 0px 10px #aaa;
}
}
div:nth-child(3) {
display: flex;
justify-content: center;
align-items: center;
}
}
.aside_box {
background-color: #817bdf;
.el-menu {
border-right: none;
}
}
}
}
</style>
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229