mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-17 14:43:41 +08:00
optimize the vue component communication, replace event listening with share data
This commit is contained in:
@@ -8,6 +8,8 @@ export const useSharedStore = defineStore('shared', {
|
||||
chatStream: Storage.get("chat_stream",true),
|
||||
socket: WebSocket,
|
||||
messageHandlers:{},
|
||||
mobileTheme: Storage.get("mobile_theme", "light"),
|
||||
adminTheme: Storage.get("admin_theme", "light"),
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
@@ -51,6 +53,17 @@ export const useSharedStore = defineStore('shared', {
|
||||
this.setMessageHandler(callback)
|
||||
}, 1000)
|
||||
}
|
||||
},
|
||||
removeMessageHandler(key) {
|
||||
delete this.messageHandlers[key]
|
||||
},
|
||||
setMobileTheme(theme) {
|
||||
this.mobileTheme = theme
|
||||
Storage.set("mobile_theme", theme)
|
||||
},
|
||||
setAdminTheme(theme) {
|
||||
this.adminTheme = theme
|
||||
Storage.set("admin_theme", theme)
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user