5
5
<template >
6
6
<div class =" article-iterator" >
7
7
<el-card class =" article-iterator__item" v-for =" (article, index) in articles" :key =" index" >
8
- <div class =" article-iterator__item -content" >
9
- <div class =" article-iterator__item-pic " >
8
+ <div class =" item -content" >
9
+ <div class =" item-content__pic " >
10
10
<img :src =" article.headerPic" alt =" " />
11
11
</div >
12
- <div class =" article-iterator__item-info " >
13
- <div class =" article-iterator__item-link " >
12
+ <div class =" item-content__info " >
13
+ <div class =" item-content__link " >
14
14
<router-link :to =" '/app/article/' + article.articleId" >{{ article.title }}</router-link >
15
15
</div >
16
- <div class =" article-iterator__item-detail " >
16
+ <div class =" item-content__detail " >
17
17
<span >
18
18
<i class =" el-icon-date" ></i >
19
19
发表时间 {{ article.createTime | formatDate }}
29
29
点赞 {{ article.likeNum }}
30
30
</span >
31
31
</div >
32
- <div class =" article-iterator__item-abstract " >{{ article.abstract }}</div >
32
+ <div class =" item-content__abstract " >{{ article.abstract }}</div >
33
33
</div >
34
34
</div >
35
35
</el-card >
@@ -56,95 +56,87 @@ export default {
56
56
.article-iterator {
57
57
& __item {
58
58
height : 280px ;
59
-
59
+ @include respond-to (xs) {
60
+ height : auto ;
61
+ }
60
62
> .el-card__body {
61
63
width : 100% ;
62
64
height : 100% ;
63
65
padding : 0 ;
64
66
}
65
- & -pic {
66
- width : 45% ;
67
+ .item-content {
68
+ display : flex ;
69
+ width : 100% ;
67
70
height : 100% ;
68
- flex : 0 0 auto ;
69
- img {
70
- width : 100% ;
71
+ @include respond-to (xs) {
72
+ flex-direction : column ;
73
+ }
74
+ & __pic {
75
+ width : 45% ;
71
76
height : 100% ;
72
- object-fit : cover ;
77
+ @include respond-to (xs) {
78
+ width : 100% ;
79
+ height : 230px ;
80
+ }
81
+ flex : 0 0 auto ;
82
+ img {
83
+ width : 100% ;
84
+ height : 100% ;
85
+ object-fit : cover ;
86
+ }
73
87
}
74
- }
75
- & -info {
76
- width : 55% ;
77
- padding : 20px 30px ;
78
- flex : 0 0 auto ;
79
- display : flex ;
80
- flex-direction : column ;
81
- justify-content : center ;
82
- }
83
- & -link {
84
- flex : 0 0 auto ;
85
- @include clamp (2 );
86
- }
87
- & -detail {
88
- @include themeify () {
89
- color : themed (' color-home-article-detail' );
88
+ & __info {
89
+ width : 55% ;
90
+ padding : 20px 30px ;
91
+ flex : 0 0 auto ;
92
+ display : flex ;
93
+ flex-direction : column ;
94
+ justify-content : center ;
95
+ @include respond-to (xs) {
96
+ width : 100% ;
97
+ justify-content : normal ;
98
+ padding : 16px ;
99
+ }
90
100
}
91
- font-size : 12px ;
92
- padding : 12px 0 ;
93
- }
94
- & -abstract {
95
- line-height : 2 ;
96
- flex : 0 0 auto ;
97
- @include clamp (2 );
98
- }
99
- }
100
-
101
- & __item-content {
102
- display : flex ;
103
- width : 100% ;
104
- height : 100% ;
105
- a {
106
- font-size : 24px ;
107
- line-height : 1.5 ;
108
- transition : all ease-in-out 0.25s ;
109
- }
110
- a :hover {
111
- @include themeify () {
112
- color : themed (' color-ele-primary' );
101
+ & __link {
102
+ flex : 0 0 auto ;
103
+ @include clamp (2 );
104
+ a {
105
+ font-size : 24px ;
106
+ line-height : 1.5 ;
107
+ transition : all ease-in-out 0.25s ;
108
+ @include respond-to (xs) {
109
+ font-size : 18px ;
110
+ }
111
+ }
112
+ a :hover {
113
+ @include themeify () {
114
+ color : themed (' color-ele-primary' );
115
+ }
116
+ }
117
+ }
118
+ & __detail {
119
+ @include themeify () {
120
+ color : themed (' color-home-article-detail' );
121
+ }
122
+ font-size : 12px ;
123
+ padding : 12px 0 ;
124
+ }
125
+ & __abstract {
126
+ line-height : 2 ;
127
+ flex : 0 0 auto ;
128
+ @include clamp (2 );
113
129
}
114
130
}
115
131
}
116
-
117
132
& __item :not (:first-child ) {
118
133
margin-top : 20px ;
119
134
}
120
- & __item :nth-child (even ) .article-iterator__item-pic {
135
+ & __item :nth-child (even ) .item-content__pic {
121
136
order : 1 ;
122
- }
123
-
124
- @include respond-to (xs) {
125
- & __item {
126
- height : auto ;
127
- & -pic {
128
- width : 100% ;
129
- height : 230px ;
130
- }
131
- & -info {
132
- width : 100% ;
133
- justify-content : normal ;
134
- padding : 16px ;
135
- a {
136
- font-size : 18px ;
137
- }
138
- }
139
- }
140
- & __item :nth-child (even ) .article-iterator__item-pic {
137
+ @include respond-to (xs) {
141
138
order : 0 ;
142
139
}
143
140
}
144
- @include respond-to (xs) {
145
- & __item-content {
146
- flex-direction : column ;
147
- }
148
- }
149
141
}
150
142
</style >
0 commit comments