mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-05 05:29:01 +08:00
20 lines
580 B
TypeScript
20 lines
580 B
TypeScript
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);
|
|
};
|