feat:完善整体样式

This commit is contained in:
zjc
2025-01-02 18:32:49 +08:00
parent d67ac75031
commit ab1ab210a9
23 changed files with 744 additions and 305 deletions

View File

@@ -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)