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/vc-select/hooks/useBaseProps.ts

25 lines
727 B

/**
* BaseSelect provide some parsed data into context.
* You can use this hooks to get them.
*/
import type { InjectionKey } from 'vue';
import { inject, provide } from 'vue';
import type { BaseSelectProps } from '../BaseSelect';
export interface BaseSelectContextProps extends BaseSelectProps {
triggerOpen: boolean;
multiple: boolean;
toggleOpen: (open?: boolean) => void;
}
const BaseSelectContextKey: InjectionKey<BaseSelectContextProps> = Symbol('BaseSelectContextKey');
export function useProvideBaseSelectProps(props: BaseSelectContextProps) {
return provide(BaseSelectContextKey, props);
}
export default function useBaseProps() {
return inject(BaseSelectContextKey, {} as BaseSelectContextProps);
}