Nuxt Vue 在线QQ咨询组件

一般企业网站/个人博客都会用到这种漂浮的在线QQ咨询软件

PNG素材图片>> png素材

组件调用

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
<template>
<div>
<QqContact :data="qq" />
</div>
</template>

<script>
import QqContact from '~/components/qq-contact.vue'
export default {
components: {
QqContact
},
data() {
return {
qq: [
{
name: '林老师',
qq: '123456'
},
{
name: '吴老师',
qq: '1234567'
}
]
}
}
}
</script>

代码实例(qq-contact.vue):

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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<template>
<div class="rides-cs">
<div class="floatL">
<a
:style="{display:btnOpenStatus}"
class="btnOpen"
title="查看在线客服"
@click="open()"
>展开</a>
<a
:style="{display:btnCLoseStatus}"
class="btnCtn"
title="关闭在线客服"
@click="close()"
>收缩</a>
</div>
<div
:style="{display:status}"
class="floatR"
>
<ul>
<li v-for="item in data" :key="item.key">
<span>{{ item.name }}</span>
<a
target="_blank"
:href="'http://wpa.qq.com/msgrd?v=3&uin=' + item.qq + '&site=qq&menu=yes'"
>
<img
:src="'http://wpa.qq.com/pa?p=2:' + item.qq + ':51'"
>
</a>
</li>
</ul>
</div>
</div>
</template>

<script>
export default {
name: 'QqContact',
props: {
data: {
type: Array,
required: true
}
},
data() {
return {
status: 'none',
btnOpenStatus: 'block',
btnCLoseStatus: 'none'
}
},
methods: {
open() {
this.status = 'block'
this.btnOpenStatus = 'none'
this.btnCLoseStatus = 'block'
},
close() {
this.status = 'none'
this.btnOpenStatus = 'block'
this.btnCLoseStatus = 'none'
}
}
}
</script>

<style scoped>

.rides-cs {
background:#1c683b;
position: fixed;
bottom: 30%;
right: 1px;
z-index: 999;
padding:5px 5px 5px 0;
}
.rides-cs a {
color: #00a0e9;
}
.rides-cs a:hover {
color: #ff8100;
text-decoration: none;
}
.rides-cs .floatL {
width: 36px;
float: left;
position: relative;
z-index: 1;
}
.rides-cs .floatL a {
font-size: 0;
text-indent: -999em;
display: block;

}
.rides-cs .floatR {
width: 135px;
float: left;
padding: 5px 0 5px 5px;
overflow: hidden;

}
.rides-cs .floatR {
background: #f7f7f7;
min-height: 159px

}

.rides-cs ul {
padding: 0px;
}
.rides-cs ul li {
line-height: 36px;
border-bottom: solid 1px #e6e4e4;
overflow: hidden;
}
.rides-cs ul li span {
color: #777;
}
.rides-cs ul li img {
vertical-align: middle;
}
.rides-cs .btnOpen,
.rides-cs .btnCtn {
position: relative;
z-index: 9;
top: 0;
left: 0;
background: url(/shopnc.png) no-repeat;
display: block;
width: 100%;
height: 160px;
overflow: hidden;
padding: 8px;
}
.rides-cs .btnOpen {
background-position: 8px 12px;
}
.rides-cs .btnCtn {
background-position: -31px 12px;
}
</style>

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×