feat:引入长连接

This commit is contained in:
Xwen
2024-01-04 21:37:35 +08:00
parent 7ca101e5dd
commit cdb6df4a8f
8 changed files with 2242 additions and 1410 deletions

View File

@@ -0,0 +1,23 @@
import { defineStore } from "pinia";
const socketStore = defineStore("socket", {
state: () => ({
onlineNum: 1,
}),
actions: {
// 获取在线总数
getOnlineNum() {
return this.onlineNum;
},
// 设置在线总数
setOnlineNum(value) {
this.onlineNum = value;
},
},
persist: {
key: "onlineInfo",
storage: window.sessionStorage,
},
});
export default socketStore;