StepTwo.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <div class="step-2">
  3. <div class="ptc-block">
  4. <p class="ptc-label">Choose a mobile phone brand</p>
  5. <PtcRadioGroup v-model="state.brand" class="device-list">
  6. <PtcRadio
  7. v-for="brand of brandList"
  8. :key="brand.name"
  9. class="device-item"
  10. :value="brand.name"
  11. >
  12. <img class="device-img" />
  13. <p class="device-name">{{ brand.name }}</p>
  14. </PtcRadio>
  15. </PtcRadioGroup>
  16. </div>
  17. <template v-if="state.brand">
  18. <div class="ptc-block">
  19. <p class="ptc-label">Choose phone model</p>
  20. <PtcRadioGroup v-model="state.model" class="device-list">
  21. <PtcRadio
  22. v-for="model of modelList"
  23. :key="model.name"
  24. class="device-item"
  25. :value="model.name"
  26. >
  27. <img class="device-img" />
  28. <p class="device-name">{{ model.name }}</p>
  29. </PtcRadio>
  30. </PtcRadioGroup>
  31. </div>
  32. <div class="ptc-button-group">
  33. <button class="ptc-button" @click="$emit('next')">$89 NEXT</button>
  34. </div>
  35. </template>
  36. </div>
  37. </template>
  38. <script setup lang="ts">
  39. import { PtcRadioGroup, PtcRadio } from '@/components/radio'
  40. import { state } from './store'
  41. defineEmits<{
  42. (e: 'next'): void
  43. }>()
  44. const brandList = [
  45. { name: 'iPhone', img: '' },
  46. { name: 'iPad', img: '' },
  47. { name: 'Samsung', img: '' },
  48. { name: 'Xiaomi', img: '' },
  49. ]
  50. const modelList = [
  51. { name: 'iPhone13 Pro', img: '' },
  52. { name: 'iPhone13', img: '' },
  53. { name: 'iPhone12', img: '' },
  54. { name: 'iPhoneSE', img: '' },
  55. ]
  56. </script>
  57. <style lang="scss">
  58. .device {
  59. &-list {
  60. display: flex;
  61. flex-wrap: wrap;
  62. }
  63. &-item {
  64. padding-top: 24px;
  65. width: 322px;
  66. height: 322px;
  67. text-align: center;
  68. font-size: 40px;
  69. font-weight: bold;
  70. &:nth-child(2n + 1) {
  71. margin-right: 34px;
  72. }
  73. &:nth-child(n + 3) {
  74. margin-top: 36px;
  75. }
  76. }
  77. &-img {
  78. margin-bottom: 18px;
  79. width: 200px;
  80. height: 200px;
  81. background: teal;
  82. }
  83. }
  84. </style>