useVoluntaryStepInjection.js 446 B

1234567891011121314151617181920
  1. import {ref} from 'vue';
  2. import {injectLocal, provideLocal} from "@vueuse/core";
  3. const key = Symbol('VOLUNTARY_STEP')
  4. export const useProvideVoluntaryStep = (t = '志愿填报', step = 0) => {
  5. const title = ref(t)
  6. const currentStep = ref(step)
  7. const options = {
  8. title,
  9. currentStep
  10. }
  11. provideLocal(key, options)
  12. return options
  13. }
  14. export const useInjectVoluntaryStep = () => {
  15. return injectLocal(key)
  16. }