create-iking-admin
Version:
金合技术中台脚手架
27 lines (22 loc) • 728 B
text/typescript
/*
* @Author: wfl
* @LastEditors: wfl
* @description:
* @updateInfo:
* @Date: 2022-08-12 18:42:51
* @LastEditTime: 2022-08-29 14:05:01
*/
import { ikingCore } from 'iking-vue-hooks';
import type { ComputedRef, InjectionKey, Ref } from 'vue';
export interface PageContextProps {
contentHeight: ComputedRef<number>;
pageHeight: Ref<number>;
setPageHeight: (height: number) => Promise<void>;
}
const key: InjectionKey<PageContextProps> = Symbol();
export function createPageContext(context: PageContextProps) {
return ikingCore.createContext<PageContextProps>(context, key, { native: true });
}
export function usePageContext() {
return ikingCore.useContext<PageContextProps>(key);
}