feat:完善整体样式
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { ref } from 'vue'
|
||||
|
||||
export function useWebSocket(url) {
|
||||
let socket = ref(null)
|
||||
let data = ref(null)
|
||||
let isConnected = ref(false)
|
||||
let socket = ref(null) // socket对象
|
||||
let data = ref(null) // 存储接收到的数据
|
||||
let isConnected = ref(false) // 是否连接成功
|
||||
|
||||
const connectWebSocket = () => {
|
||||
socket.value = new WebSocket(url, 'echo-protocol', {
|
||||
@@ -15,13 +15,6 @@ export function useWebSocket(url) {
|
||||
socket.value.onopen = () => {
|
||||
isConnected.value = true
|
||||
console.log('WebSocket connected')
|
||||
sendMessage(
|
||||
JSON.stringify({
|
||||
action: 'start',
|
||||
type: 'index',
|
||||
scenitspot: 'index'
|
||||
})
|
||||
)
|
||||
}
|
||||
socket.value.onerror = (error) => {
|
||||
console.error('WebSocket error:', error)
|
||||
|
||||
Reference in New Issue
Block a user