mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): add websocket demo
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { nextTick } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import type { Socket } from 'socket.io-client';
|
||||
import { LAYOUT_SCROLL_EL_ID } from '@soybeanjs/vue-materials';
|
||||
|
||||
interface AppState {
|
||||
@ -17,6 +18,8 @@ interface AppState {
|
||||
siderCollapse: boolean;
|
||||
/** vertical-mix模式下 侧边栏的固定状态 */
|
||||
mixSiderFixed: boolean;
|
||||
/** socket.io 实例 */
|
||||
socket: Socket | null;
|
||||
}
|
||||
|
||||
export const useAppStore = defineStore('app-store', {
|
||||
@ -27,7 +30,8 @@ export const useAppStore = defineStore('app-store', {
|
||||
reloadFlag: true,
|
||||
settingDrawerVisible: false,
|
||||
siderCollapse: false,
|
||||
mixSiderFixed: false
|
||||
mixSiderFixed: false,
|
||||
socket: null
|
||||
}),
|
||||
actions: {
|
||||
/**
|
||||
@ -97,6 +101,10 @@ export const useAppStore = defineStore('app-store', {
|
||||
/** 设置主体内容全屏 */
|
||||
setContentFull(full: boolean) {
|
||||
this.contentFull = full;
|
||||
},
|
||||
/** 设置socket实例 */
|
||||
setSocket<T extends Socket = Socket>(socket: T) {
|
||||
this.socket = socket;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user