import { ref, nextTick } from 'vue'; import type { Ref } from 'vue'; import { useContext } from '@/hooks'; interface ReloadContext { reload: Ref; handleReload(): void; } const { useProvide, useInject: useReloadInject } = useContext(); /** 重载上下文 */ export default function useReloadContext() { const reload = ref(true); function handleReload() { reload.value = false; nextTick(() => { nextTick(() => { reload.value = true; }); }); } const context: ReloadContext = { reload, handleReload }; function useReloadProvide() { useProvide(context); } return { context, useReloadProvide, useReloadInject }; }