context.js 590 B

123456789101112131415
  1. import { inject, provide } from 'vue';
  2. const radioGroupContextKey = Symbol('radioGroupContextKey');
  3. export const useProvideRadioGroupContext = props => {
  4. provide(radioGroupContextKey, props);
  5. };
  6. export const useInjectRadioGroupContext = () => {
  7. return inject(radioGroupContextKey, undefined);
  8. };
  9. const radioOptionTypeContextKey = Symbol('radioOptionTypeContextKey');
  10. export const useProvideRadioOptionTypeContext = props => {
  11. provide(radioOptionTypeContextKey, props);
  12. };
  13. export const useInjectRadioOptionTypeContext = () => {
  14. return inject(radioOptionTypeContextKey, undefined);
  15. };