Skip to content

Commit 05b05ab

Browse files
committed
加入侧边栏
1 parent d34c6b9 commit 05b05ab

File tree

12 files changed

+193
-8
lines changed

12 files changed

+193
-8
lines changed

src/App.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,35 @@
22
<div id="app">
33
<VHeader></VHeader>
44
<VContent></VContent>
5+
<AsideMenu></AsideMenu>
56
</div>
67
</template>
78

89
<script>
910
import VHeader from './components/Header/Header.vue';
1011
import VContent from './components/Content/Content.vue';
12+
import AsideMenu from './components/AsideMenu/AsideMenu.vue';
1113
1214
export default {
1315
name: 'app',
1416
components: {
1517
VHeader,
16-
VContent
18+
VContent,
19+
AsideMenu
1720
}
1821
}
1922
</script>
2023

2124
<style lang="scss">
2225
@import "./common/style/base.scss";
2326
24-
$headerColor: #00bcd4;
2527
2628
#app {
29+
position: relative;
2730
width: 100%;
2831
height: 100%;
2932
display: flex;
3033
flex-direction: column;
31-
// background-color: blue;
3234
3335
}
3436
</style>

src/common/icons/icon-about.svg

Lines changed: 1 addition & 0 deletions
Loading

src/common/icons/icon-collect.svg

Lines changed: 1 addition & 0 deletions
Loading

src/common/icons/icon-info.svg

Lines changed: 1 addition & 0 deletions
Loading

src/common/icons/icon-msg-blue.svg

Lines changed: 1 addition & 0 deletions
Loading

src/common/icons/icon-unlogin.svg

Lines changed: 1 addition & 0 deletions
Loading

src/common/style/base.scss

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ pre, code {display: block;overflow: auto;background: #f4f4f4;padding: 5px 10px;b
128128
transition: all .5s ease;
129129
}
130130
.slide-fade-enter, .slide-fade-leave-active {
131-
transform: translateX(20px);
131+
transform: translateX(40px);
132+
opacity: 0;
133+
}
134+
.slide-left-enter-active {
135+
transition: all .3s ease;
136+
}
137+
.slide-left-leave-active {
138+
transition: all .2s ease-out;
139+
}
140+
.slide-left-enter, .slide-left-leave-active {
141+
transform: translateX(-150px);
132142
opacity: 0;
133143
}
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
<template lang="html">
2+
<transition name="slide-left">
3+
<div v-show="isShowAsideMenu" class="aside-menu">
4+
<div class="menu">
5+
6+
<div class="user">
7+
<div class="user-avatar">
8+
<img src="../../common/icons/icon-unlogin.svg" alt="">
9+
</div>
10+
<div class="username">
11+
点击头像登录
12+
</div>
13+
</div>
14+
15+
<div class="infos block">
16+
17+
<div class="msg block">
18+
<i class="icon-msg"></i>我的消息
19+
</div>
20+
21+
<div class="collect block">
22+
<i class="icon-collect"></i>我的收藏
23+
</div>
24+
25+
<div class="info block">
26+
<i class="icon-info"></i>我的信息
27+
</div>
28+
29+
<div class="about block">
30+
<i class="icon-about"></i>关于
31+
</div>
32+
33+
34+
</div>
35+
36+
</div>
37+
38+
<div @click.stop.prevent="showAsideMenu" class="mask"></div>
39+
40+
</div>
41+
</transition>
42+
43+
</template>
44+
45+
<script>
46+
export default {
47+
name: 'asideMenu',
48+
computed: {
49+
isShowAsideMenu() {
50+
return this.$store.state.isShowAsideMenu;
51+
}
52+
},
53+
methods: {
54+
showAsideMenu() {
55+
this.$store.commit('showAsideMenu', false);
56+
}
57+
}
58+
}
59+
</script>
60+
61+
<style lang="scss" scoped>
62+
.aside-menu {
63+
position: absolute;
64+
display: flex;
65+
z-index: 1;
66+
top: 0;
67+
bottom: 0;
68+
left: 0;
69+
right: 0;
70+
width: 100%;
71+
height: 100%;
72+
73+
.menu {
74+
display: flex;
75+
flex-direction: column;
76+
width: 220px;
77+
background-color: white;
78+
box-shadow: 0 0 12px gray;
79+
.user {
80+
display: flex;
81+
flex-direction: column;
82+
justify-content: center;
83+
align-items: center;
84+
width: 100%;
85+
height: 200px;
86+
background-color: #2196F3;
87+
color: white;
88+
.user-avatar {
89+
img {
90+
width: 100px;
91+
height: 100px;
92+
border-radius: 50px;
93+
}
94+
}
95+
}
96+
97+
.infos {
98+
99+
display: flex;
100+
flex-direction: column;
101+
align-items: center;
102+
flex: 1;
103+
104+
.block {
105+
width: 100%;
106+
height: 50px;
107+
display: flex;
108+
padding-left: 50px;
109+
align-items: center;
110+
}
111+
112+
.block + .block {
113+
border-top: 1px solid rgba(0, 0, 0, .05);
114+
}
115+
i {
116+
display: inline-block;
117+
width: 22px;
118+
height: 22px;
119+
background-repeat: no-repeat;
120+
margin-right: 8px;
121+
}
122+
.icon-msg {
123+
background: url('../../common/icons/icon-msg-blue.svg');
124+
background-size: contain;
125+
}
126+
.icon-collect {
127+
background: url('../../common/icons/icon-collect.svg');
128+
background-size: contain;
129+
}
130+
.icon-msg {
131+
background: url('../../common/icons/icon-msg-blue.svg');
132+
background-size: contain;
133+
}
134+
.icon-info {
135+
background: url('../../common/icons/icon-info.svg');
136+
background-size: contain;
137+
}
138+
.icon-about {
139+
background: url('../../common/icons/icon-about.svg');
140+
background-size: contain;
141+
}
142+
.about {
143+
// letter-spacing: 1em;
144+
}
145+
}
146+
}
147+
148+
.mask {
149+
flex: 1;
150+
}
151+
}
152+
</style>

src/components/Content/ArticleList.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ export default {
136136
137137
}
138138
139+
.title:hover {
140+
background-color: #F5F5F5;
141+
}
142+
139143
@media screen and (min-width: 760px) {
140144
.title {
141145
padding-left: 3%;
@@ -148,6 +152,7 @@ export default {
148152
}
149153
}
150154
}
155+
151156
@media screen and (min-width: 760px) {
152157
.item {
153158
margin: auto;

src/components/Content/Content.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export default {
117117
align-items: center;
118118
text-align: center;
119119
color: white;
120-
background-color: #00bcd4;
120+
background-color: #2196F3;
121121
font-size: 110%;
122122
letter-spacing: 2px;
123123
a {

0 commit comments

Comments
 (0)