You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
apply-assistant-v3/uni_modules/gao-ChatSSEClient/components/gao-ChatSSEClient/gao-ChatSSEClient.vue

59 lines
1.3 KiB
Vue

<template>
<!-- #ifdef MP-WEIXIN-->
<ChatWxApplet ref="chatRef" @onInnerOpen="open" @onInnerError="error" @onInnerMessage="message" @onInnerFinish="finish" />
<!-- #endif-->
<!-- #ifdef APP-PLUS || H5-->
<ChatAppAndWeb ref="chatRef" @onInnerOpen="open" @onInnerError="error" @onInnerMessage="message" @onInnerFinish="finish" />
<!-- #endif-->
</template>
<script>
// #ifdef MP-WEIXIN
import ChatWxApplet from "./children/ChatWxApplet.vue";
// #endif
// #ifdef APP-PLUS || H5
import ChatAppAndWeb from "./children/ChatAppAndWeb.vue";
// #endif
export default {
components: {
// #ifdef MP-WEIXIN
ChatWxApplet,
// #endif
// #ifdef APP-PLUS || H5
ChatAppAndWeb,
// #endif
},
methods: {
startChat(config) {
config["method"] = (config["method"] || "post").toUpperCase();
config["headers"] = config["headers"] || {};
console.log("this.$refs['chatRef']", this.$refs["chatRef"]);
this.$refs["chatRef"].startChat(config);
},
stopChat(...args) {
console.log("this.$refs['chatRef']stopChat", this.$refs["chatRef"]);
this.$refs["chatRef"].stopChat(...args);
},
open(...args) {
this.$emit("onOpen", ...args);
},
message(msg) {
this.$emit("onMessage", msg);
},
error(...args) {
this.$emit("onError", ...args);
},
finish() {
this.$emit("onFinish");
},
},
};
</script>