userList.vue
1.65 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
<template>
<div class="userList" v-loading="loading">
<ul v-if="personList.length">
<li
v-for="(item, index) in personList"
class="list"
:class="{ active: index == active }"
:key="index"
@click="liClick(item, index)">
<img v-if="item.avatar" class="fl mr10" :src="item.avatar" />
<img class="fl mr10" v-else src="../../../../assets/drainageCode/header.png" />
<div class="name" :title="item.name">
{{ item.name }}
</div>
</li>
</ul>
<el-empty v-else :image-size="100"></el-empty>
</div>
</template>
<script>
export default {
props: {
personList: {
type: Array,
defluat: () => [],
},
loading: {
type: Boolean,
defluat: false,
},
},
data() {
return {
loadings: true,
active: undefined,
}
},
methods: {
liClick(data, index) {
this.active = index
this.$emit('chatFn', data)
},
},
}
</script>
<style lang="scss" scoped>
.userList {
overflow-y: auto;
// height: calc(100vh - 288px);
height: 100%;
::-webkit-scrollbar {
display: none;
}
::v-deep .el-loading-spinner {
margin-top: 20px;
}
.gray {
color: #999;
}
.list {
padding: 10px;
overflow: hidden;
border-bottom: 1px solid #efefef;
cursor: pointer;
text-align: left;
.name {
white-space: nowrap;
overflow: hidden;
line-height: 40px;
text-overflow: ellipsis;
}
&:hover {
background: #efefef;
}
&.active {
background: var(--color-lighter);
}
img {
width: 40px;
height: 40px;
float: left;
}
}
}
</style>