mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-04 04:58:16 +08:00
26 lines
670 B
TypeScript
26 lines
670 B
TypeScript
import { computed } from 'vue';
|
|
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, {
|
|
gutter: computed(() => undefined),
|
|
wrap: computed(() => undefined),
|
|
supportFlexGap: computed(() => undefined),
|
|
});
|
|
};
|
|
|
|
export { useInjectRow, useProvideRow };
|
|
export default useProvideRow;
|