index.vue
1.0 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
<!-- 客服兼容 -->
<template>
<view class="chat-template-box" v-if="showChat">
<Chat v-if="isShoproChat"></Chat>
<Wm v-if="!isShoproChat" :options="kefuOptions"></Wm>
</view>
</template>
<script>
import {
mapMutations,
mapActions,
mapState,
mapGetters
} from "vuex";
import Chat from "./shopro/index.vue";
import Wm from "./wm/index.vue";
export default {
components: {
Chat,
Wm
},
data() {
return {
isShoproChat: false,
kefuOptions: null,
showChat: false
};
},
computed: {
...mapGetters(["initAddons", "initChat"])
},
onLoad(options) {
this.kefuOptions = options;
//判断客服;
if (this.initChat && this.initChat.type === "shopro") {
this.isShoproChat = true;
} else {
if (this.initAddons.length && this.initAddons.includes("kefu")) {
this.isShoproChat = false;
}
}
this.showChat = true;
},
methods: {}
};
</script>
<style lang="scss">
.chat-template-box {
height: 100%;
width: 100%;
overflow: hidden;
}
</style>