list-item.vue
1.94 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
<template>
<div class="topic-item" @click="toTopic">
<div class="topic-cover">
<ImageFormat v-if="data.topicImageUrl" :src="data.topicImageUrl" :mode="1" :width="240" :height="240"></ImageFormat>
</div>
<div class="topic-info">
<div class="topic-name">
<span>#{{data.topicName}}</span>
<div v-if="data.isHot > 0" class="hot"></div>
</div>
<p class="topic-desc">{{data.topicDesc}}</p>
</div>
</div>
</template>
<script>
import {get} from 'lodash';
export default {
data() {
return {}
},
props: [
'data'
],
methods: {
toTopic() {
this.$router.push({
name: 'topic',
params: {
topicId: this.data.id,
topicName: this.data.topicName
}
});
}
}
};
</script>
<style scoped>
.topic-item {
display: flex;
padding: 14px 30px;
.topic-cover {
width: 120px;
height: 120px;
background-color: #ccc;
margin-right: 20px;
flex-shrink: 0;
img {
width: 100%;
height: 100%;
display: block;
}
}
.topic-info {
flex-grow: 1;
}
.topic-name {
font-size: 32px;
line-height: 1.6;
color: #222;
letter-spacing: 0.08PX;
font-weight: 500;
margin-bottom: 8px;
display: flex;
justify-content: space-between;
span {
display: inline-block;
max-width: 400px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.hot {
width: 92px;
height: 30px;
background-image: url('~statics/image/article/topic-hot.png');
background-size: contain;
background-repeat: no-repeat;
align-self: center;
}
}
.topic-desc {
font-size: 24px;
line-height: 1.3;
color: #b0b0b0;
letter-spacing: 0.06PX;
overflow:hidden;
word-break: break-all;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
}
</style>