widget-topic.vue
1.71 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
<template>
<div v-if="topic" class="topic-wrap" @click="onClick">
<div class="topic-icon"></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-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAMAAADyHTlpAAAAWlBMVEUAAAAiIiIiIiIjIyMnJyciIiIiIiIiIiIiIiIjIyMkJCQjIyMiIiIkJCQrKysjIyMjIyMiIiL///+QkJCgoKCAgIDf39+/v79hYWFBQUHv7+/AwMCvr69gYGDJAUDtAAAAEXRSTlMA36PzLi342cO/j4geFQZ8e771dgcAAAEVSURBVDjLlZXJrsMgDEUNhBKSZrCTTm/4/98sUh0JkybAWdzVXcARNpBgZ+2dMc7r2cIJtlMYobqj9lXjDn2FPWN/wS9c+hEShhYPaAcQNAoPUY1oGjzBRN1B4SlqAGZsMUO73a3HLD37TCwty8IZOfv4Tcy/iO6cERoCFiVPogdnjA3VDiU3opUzpgvVVNRKdOMUwoJ9TPgl+ucUNDCJuwd+iFZOIWES96cdwoEvrXpwyQH+glBOeQAHJudqw4DJu9qqDiUPoienxIFHyZ3oxSnxNbKm0uoMtrRqAVSZKyUfYeoqfYS2zJWFgC5xpeUYpjMoxrB8uCtWRv0iyq+3+qWZX8XlC77m26j/jFKaafvipgYkb9BQXEZhgbcaAAAAAElFTkSuQmCC');
background-size: 100% 100%;
}
.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>