useVoluntaryStepInjection.js 423 B

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