appointment.vue 974 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <div class="p-repair" :class="{ step0: state.step === 0 }">
  3. <component :is="Component" />
  4. </div>
  5. </template>
  6. <script setup lang="ts">
  7. import { computed, watch, onUnmounted } from 'vue'
  8. import { useRouter, useRoute } from 'vue-router'
  9. import StepOne from './steps/StepOne.vue'
  10. import StepTwo from './steps/StepTwo.vue'
  11. import StepThree from './steps/StepThree.vue'
  12. // import StepFour from './steps/StepFour.vue'
  13. import StepFive from './steps/StepFive.vue'
  14. import { state, resetState } from './store'
  15. import { state as rootState } from '@/store'
  16. const Component = computed(
  17. () => [StepOne, StepTwo, StepThree, StepFive][state.step]
  18. )
  19. const { id, right_id } = useRoute().query as any
  20. id && (state.repairId = id)
  21. right_id && (state.rightId = right_id)
  22. onUnmounted(() => resetState())
  23. watch(
  24. () => state.step,
  25. () => {
  26. window.scrollTo(0, 0)
  27. rootState.bgWhite = state.step === 3
  28. }
  29. )
  30. </script>
  31. <style lang="scss" src="./index.scss"></style>