vben
2020-11-25 26b6109ca08a28c37355474bf8593f2e2b741ef6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { InjectionKey, Ref } from 'vue';
import { createContext, useContext } from '/@/hooks/core/useContext';
 
export interface LayoutContextProps {
  fullHeaderRef: Ref<ComponentRef>;
}
 
const layoutContextInjectKey: InjectionKey<LayoutContextProps> = Symbol();
 
export function createLayoutContext(context: LayoutContextProps) {
  return createContext<LayoutContextProps>(context, layoutContextInjectKey);
}
 
export function useLayoutContext() {
  return useContext<LayoutContextProps>(layoutContextInjectKey);
}