模块调整

This commit is contained in:
zhongluofeng committed 2026-10-28 15:57:31 +08:00
1 parent fcbcf07b87
commit 6f875bd7b4
23 files changed
+538 -116

No files matched your search

+7 -3
View File
@@ -44,13 +44,17 @@ export const moduleConfig: ModuleConfig = {
loader: () => import('./DshModule.vue'),
searchItems,
lifecycle: {
// 模块启用:恢复全局快捷键(应用启动时由 main.ts 注册;这里覆盖「先禁用再启用」)
// 模块启用:先刷新设置再恢复全局快捷键(启动时模块若被禁用,设置从未加载过),
// 并按 autoStart 决定是否拉起服务。
onEnable: async () => {
try {
const { useDshStore } = await import('@/stores/dshStore')
await useDshStore().registerShortcut()
const store = useDshStore()
await store.refresh()
await store.registerShortcut()
if (store.settings?.autoStart && !store.running) await store.start()
} catch (e) {
console.error('[dsh] onEnable 注册快捷键失败:', e)
console.error('[dsh] onEnable 恢复失败:', e)
}
},
// 模块禁用:停服务 + 注销快捷键(服务停了快捷键也没意义,且组合键不该被占着)