| 12345678910111213141516171819 |
- import {computed, ref} from 'vue'
- import {injectLocal, provideLocal} from "@vueuse/core";
- const key = Symbol('ACTIVATE_STEPS_SERVICE')
- export const useProvideActivateSteps = function () {
- const step = ref(0)
- const steps = ref(['校验会员卡', '确认信息', '绑卡完成'])
- const buttonText = computed(() => steps.value[step.value])
- const completed = computed(() => step.value == steps.value.length - 1)
- const loading = ref(false)
- const options = {steps, step, buttonText, loading, completed}
- provideLocal(key, options)
- return options
- }
- export const useInjectActivateSteps = function () {
- return injectLocal(key)
- }
|