wang
2024-03-28 04adb88a2ed54cdf4c2958c79972c30109b9b5b6
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
<script setup>
import { useRouter, useRoute } from 'vue-router'
 
import { sendSock, createWebSocket, closeSock } from "@/utils/webSocket"
 
// function global_callback(msg) {
//   console.log("websocket的回调函数收到服务器信息:" + JSON.stringify(msg));
//   // console.log("收到服务器信息:" + msg);
// }
// function close(){
//  closeSock();
 
// }
// function sendMessage(){
//   sendSock("123")
// }
// function createSocket(){
//   createWebSocket(global_callback);
// }
// </script>
 
 
<template>
 <div class="mainDiv">
   <button @click="createSocket">创建</button>
   <button @click="sendMessage">发送</button>
   <button @click="close">关闭</button>
 </div>
</template>