ant-design-vue/components/grid/context.ts

21 lines
508 B
TypeScript
Raw Normal View History

2021-05-25 15:18:31 +00:00
import { Ref, inject, InjectionKey, provide, ComputedRef } from 'vue';
export interface RowContext {
gutter: ComputedRef<[number, number]>;
wrap: ComputedRef<boolean>;
supportFlexGap: Ref<boolean>;
}
export const RowContextKey: InjectionKey<RowContext> = Symbol('rowContextKey');
const useProvideRow = (state: RowContext) => {
provide(RowContextKey, state);
};
const useInjectRow = () => {
return inject(RowContextKey);
};
export { useInjectRow, useProvideRow };
export default useProvideRow;