follow-topic-item.vue
1.92 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
<template>
<div class="topic-item">
<div class="topic-cover" @click="toTopic">
<ImageFormat v-if="data.topicImageUrl" :src="data.topicImageUrl" :mode="1" :width="200" :height="200"></ImageFormat>
</div>
<div class="topic-info" @click="toTopic">
<div class="topic-name">
<span>#{{data.topicName}}</span>
</div>
<p v-if="+data.topicJoinNum" class="topic-desc">{{data.topicJoinNum}}人参与讨论</p>
</div>
<WidgetFollow class="option-btn" :topic-id="data.topicId" :follow="data.hasAttention"></WidgetFollow>
</div>
</template>
<script>
export default {
data() {
return {};
},
props: [
'data'
],
methods: {
toTopic() {
this.$router.push({
name: 'topic',
params: {
topicId: this.data.topicId,
topicName: this.data.topicName
}
});
}
}
};
</script>
<style scoped lang="scss">
.topic-item {
height: 178px;
display: flex;
align-items: center;
.topic-cover {
width: 120px;
height: 120px;
background-color: #ccc;
margin-right: 20px;
flex-shrink: 0;
img {
width: 100%;
height: 100%;
display: block;
}
}
.topic-info {
height: 120px;
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;
}
}
.topic-desc {
max-width: 400px;
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;
}
.option-btn {
margin: 0 30px;
}
}
</style>