useLayoutContext.ts 456 B

12345678910111213141516
  1. import { InjectionKey, Ref } from 'vue';
  2. import { createContext, useContext } from '/@/hooks/core/useContext';
  3. export interface LayoutContextProps {
  4. fullHeader: Ref<ComponentRef>;
  5. }
  6. const key: InjectionKey<LayoutContextProps> = Symbol();
  7. export function createLayoutContext(context: LayoutContextProps) {
  8. return createContext<LayoutContextProps>(context, key);
  9. }
  10. export function useLayoutContext() {
  11. return useContext<LayoutContextProps>(key);
  12. }