2025-05-12 18:06:19 +02:00

86 lines
2.7 KiB
JavaScript

import { createApp } from 'vue'
import App from './App.vue'
// import store from './store'
// import store from './storews'
// import VueNativeSock from "vue-native-websocket-vue3";
import "bootstrap/dist/css/bootstrap.min.css"
import "bootstrap"
// import { createStore } from "vuex";
const app = createApp(App)
// const store = createStore({
// state: {
// socket: {
// // Connection Status
// isConnected: false,
// // Message content
// message: "",
// // Reconnect error
// reconnectError: false,
// // Heartbeat message sending time
// heartBeatInterval: 50000,
// // Heartbeat timer
// heartBeatTimer: 0
// }
// },
// mutations: {
// // Connection open
// SOCKET_ONOPEN(state, event) {
// console.log(event);
// app.config.globalProperties.$socket = event.currentTarget;
// state.socket.isConnected = true;
// // When the connection is successful, start sending heartbeat messages regularly to avoid being disconnected by the server
// // state.socket.heartBeatTimer = setInterval(() => {
// // const message = "Heartbeat message";
// // state.socket.isConnected &&
// // app.config.globalProperties.$socket.sendObj({
// // code: 200,
// // msg: message
// // });
// // }, state.socket.heartBeatInterval);
// },
// // Connection closed
// SOCKET_ONCLOSE(state, event) {
// state.socket.isConnected = false;
// // Stop the heartbeat message when the connection is closed
// clearInterval(state.socket.heartBeatTimer);
// state.socket.heartBeatTimer = 0;
// console.log("The line is disconnected: " + new Date());
// console.log(event);
// },
// // An error occurred
// SOCKET_ONERROR(state, event) {
// console.error(state, event);
// },
// // Receive the message sent by the server
// SOCKET_ONMESSAGE(state, message) {
// state.socket.message = message;
// },
// // Auto reconnect
// SOCKET_RECONNECT(state, count) {
// console.info("消息系统重连中...", state, count);
// },
// // Reconnect error
// SOCKET_RECONNECT_ERROR(state) {
// state.socket.reconnectError = true;
// }
// },
// modules: {}
// })
// app.use(store)
// app.use(VueNativeSock, "ws://192.168.4.1:8080", {
// store: store
// }, {
// reconnection: true, // (Boolean) whether to reconnect automatically (false)
// reconnectionAttempts: 90, // (Number) number of reconnection attempts before giving up (Infinity),
// reconnectionDelay: 10, // (Number) how long to initially wait before attempting a new (1000)
// });
app.mount('#app')
export default app