widget-topic.vue
1.21 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
<template>
<div v-if="topic" class="topic-wrap" @click="onClick">
<div class="topic-icon">
<span>#</span>
</div>
<span class="topic-text">{{topic}}</span>
</div>
</template>
<script>
export default {
name: 'WidgetTopic',
props: {
topic: String,
},
methods: {
onClick() {
this.$emit('click');
}
}
};
</script>
<style type="scss">
.topic-wrap {
display: inline-block;
vertical-align: middle;
height: 48px;
line-height: 48px;
background-color: #f0f0f0;
border-radius: 22px;
box-sizing: border-box;
> * {
display: inline-block;
vertical-align: top;
}
.topic-icon {
width: 28px;
height: 28px;
line-height: 28px;
border-radius: 50%;
margin: 10px;
text-align: center;
background-color: #222;
> span {
font-size: 24px;
color: #fff;
transform: scale(0.8, 0.8);
display: inline-block;
}
}
.topic-text {
font-size: 26px;
font-weight: 500;
color: #222;
margin-left: -4px;
margin-right: 16px;
max-width: 310px;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
}
</style>