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/radio/context.ts

24 lines
852 B

import type { InjectionKey } from 'vue';
import { inject, provide } from 'vue';
import type { RadioGroupContext, RadioOptionTypeContextProps } from './interface';
const radioGroupContextKey: InjectionKey<RadioGroupContext> = Symbol('radioGroupContextKey');
export const useProvideRadioGroupContext = (props: RadioGroupContext) => {
provide(radioGroupContextKey, props);
};
export const useInjectRadioGroupContext = () => {
return inject(radioGroupContextKey, undefined);
};
const radioOptionTypeContextKey: InjectionKey<RadioOptionTypeContextProps> = Symbol(
'radioOptionTypeContextKey',
);
export const useProvideRadioOptionTypeContext = (props: RadioOptionTypeContextProps) => {
provide(radioOptionTypeContextKey, props);
};
export const useInjectRadioOptionTypeContext = () => {
return inject(radioOptionTypeContextKey, undefined);
};