use vueuse

This commit is contained in:
pa
2026-03-15 21:17:02 +09:00
parent 8624ac20fa
commit 9e0116fce7
9 changed files with 48 additions and 199 deletions

View File

@@ -1,4 +1,5 @@
import { computed, onMounted, onUnmounted, ref } from 'vue';
import { useEventListener } from '@vueuse/core';
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { toast } from 'vue-sonner';
@@ -243,22 +244,11 @@ export function useToolNavPinning() {
dispatchNavLayoutUpdated();
};
onMounted(() => {
if (typeof window === 'undefined') {
return;
}
window.addEventListener(NAV_LAYOUT_UPDATED_EVENT, refreshPinnedState);
});
onUnmounted(() => {
if (typeof window === 'undefined') {
return;
}
window.removeEventListener(
NAV_LAYOUT_UPDATED_EVENT,
refreshPinnedState
);
});
useEventListener(
typeof window !== 'undefined' ? window : undefined,
NAV_LAYOUT_UPDATED_EVENT,
refreshPinnedState
);
return {
pinnedToolKeys: computed(() => pinnedToolKeysRef.value),