group-item.vue
1.29 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
<template>
<div @click="handleGroupClick" class="scroll-container">
<div class="group-item">
<avatar :src="group.avatar" />
<div class="group-name text-ellipsis">{{ group.name }}</div>
</div>
</div>
</template>
<script>
export default {
props: ['group'],
data() {
return {
visible: false,
options: [
{
text: '退出群组',
handler: this.quitGroup
}
]
}
},
methods: {
handleGroupClick() {
const conversationID = `GROUP${this.group.groupID}`
this.$store.dispatch('checkoutConversation', conversationID)
},
quitGroup() {
this.tim.quitGroup(this.group.groupID)
.catch(error => {
this.$store.commit('showMessage', {
type: 'error',
message: error.message
})
})
}
}
}
</script>
<style lang="stylus" scoped>
.scroll-container
overflow-y scroll
flex 1
.group-item
display flex
padding 10px 20px
cursor pointer
position relative
overflow hidden
transition .2s
&:hover
background-color $background
.avatar
width 30px
height 30px
border-radius 50%
margin-right 10px
flex-shrink 0
.group-name
flex 1
color $font-light
line-height 30px
</style>