You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/float-button/context.ts

20 lines
580 B

import type { Ref, InjectionKey } from 'vue';
import { inject, provide, ref } from 'vue';
import type { FloatButtonShape } from './interface';
interface FloatButtonGroupContext {
shape: Ref<FloatButtonShape>;
}
const contextKey: InjectionKey<FloatButtonGroupContext> = Symbol('floatButtonGroupContext');
export const useProvideFloatButtonGroupContext = (props: FloatButtonGroupContext) => {
provide(contextKey, props);
return props;
};
export const useInjectFloatButtonGroupContext = () => {
return inject(contextKey, { shape: ref() } as FloatButtonGroupContext);
};