一、websocket投送
a.vue页面实现websocket投送
1、点击页面投送调用websocket的初始化
<template>
<div class="cssFont" @click="goWebSocket">点击将页面投送</div>
</template>
<script>
export default {
methods: {
goWebSocket(){
this.initWebSocket(); //调用初始化
},
}
}
</script>
2、methods里写好所有的websocket方法
<template>
<div class="cssFont" @click="goWebSocket">点击将页面投送</div>
</template>
<script>
export default {
mounted() {
},
beforeDestroy() {
this.websocketOnclose();
},
methods: {
goWebSocket(){
this.initWebSocket(); //调用初始化
},
initWebSocket: function () {
const that = this;
this.loading = true;
that.websocketOnclose();
let projectType = this.CQfrom.projectType; //项目类型
let projectCode = this.CQfrom.project