chore: use defaultStore instead

This commit is contained in:
Acid Chicken (硫酸鶏) 2023-03-25 12:20:49 +09:00
parent 2bce064ada
commit b56d173f8a
No known key found for this signature in database
GPG key ID: 3E87B98A3F6BAB99

View file

@ -1,10 +1,10 @@
<template> <template>
<Transition <Transition
appear appear
:enter-active-class="$store.state.animation ? $style.transition_fade_enterActive : ''" :enter-active-class="animation ? $style.transition_fade_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_fade_leaveActive : ''" :leave-active-class="animation ? $style.transition_fade_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_fade_enterFrom : ''" :enter-from-class="animation ? $style.transition_fade_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_fade_leaveTo : ''" :leave-to-class="animation ? $style.transition_fade_leaveTo : ''"
> >
<div ref="rootEl" :class="$style.root" :style="{ zIndex }" @contextmenu.prevent.stop="() => {}"> <div ref="rootEl" :class="$style.root" :style="{ zIndex }" @contextmenu.prevent.stop="() => {}">
<MkMenu :items="items" :align="'left'" @close="$emit('closed')"/> <MkMenu :items="items" :align="'left'" @close="$emit('closed')"/>
@ -17,6 +17,7 @@ import { onMounted, onBeforeUnmount } from 'vue';
import MkMenu from './MkMenu.vue'; import MkMenu from './MkMenu.vue';
import { MenuItem } from './types/menu.vue'; import { MenuItem } from './types/menu.vue';
import contains from '@/scripts/contains'; import contains from '@/scripts/contains';
import { defaultStore } from '@/store';
import * as os from '@/os'; import * as os from '@/os';
const props = defineProps<{ const props = defineProps<{
@ -28,6 +29,8 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const animation = $computed(() => defaultStore.state.animation);
let rootEl = $shallowRef<HTMLDivElement>(); let rootEl = $shallowRef<HTMLDivElement>();
let zIndex = $ref<number>(os.claimZIndex('high')); let zIndex = $ref<number>(os.claimZIndex('high'));