|
1 | 1 | <template> |
2 | | - <v-stepper-content :step="step_index + 1"> |
| 2 | + <v-stepper-content :step="props.step_index + 1"> |
3 | 3 | <v-row |
4 | 4 | align="center" |
5 | 5 | class="mb-4 py-2" |
6 | | - @click="set_current_step(step_index)" |
| 6 | + @click="set_current_step(props.step_index)" |
7 | 7 | > |
8 | 8 | <v-col cols="auto" class="d-flex justify-center align-center"> |
9 | 9 | <v-icon |
10 | | - v-if="current_step_index > step_index" |
| 10 | + v-if="props.active_step_index > props.step_index" |
11 | 11 | icon="mdi-check-circle" |
12 | 12 | color="grey" |
13 | 13 | /> |
14 | 14 | <v-icon |
15 | | - v-else-if="current_step_index == step_index" |
16 | | - :icon="`mdi-numeric-${step_index + 1}-circle`" |
| 15 | + v-else-if="props.active_step_index == props.step_index" |
| 16 | + :icon="`mdi-numeric-${props.step_index + 1}-circle`" |
17 | 17 | color="primary" |
18 | 18 | /> |
19 | 19 | <v-icon |
20 | 20 | v-else |
21 | | - :icon="`mdi-numeric-${step_index + 1}-circle`" |
| 21 | + :icon="`mdi-numeric-${props.step_index + 1}-circle`" |
22 | 22 | color="grey" |
23 | 23 | /> |
24 | 24 | </v-col> |
25 | 25 | <v-col> |
26 | 26 | <p class="m-0 font-weight-bold"> |
27 | | - {{ steps[step_index].step_title }} |
| 27 | + {{ props.step.title }} |
28 | 28 | </p> |
29 | 29 | </v-col> |
30 | 30 | <v-chip-group |
31 | 31 | v-if=" |
32 | | - steps[step_index].chips.length && current_step_index >= step_index |
| 32 | + props.step.chips.length && props.active_step_index >= props.step_index |
33 | 33 | " |
34 | 34 | column |
35 | 35 | class="d-flex flex-wrap ma-2 overflow-y-auto" |
36 | 36 | multiple |
37 | 37 | style="max-height: 150px" |
38 | 38 | > |
39 | 39 | <v-chip |
40 | | - v-for="(chip, chip_index) in steps[step_index].chips" |
| 40 | + v-for="(chip, chip_index) in props.step.chips" |
41 | 41 | :key="chip_index" |
42 | 42 | class="ma-1" |
43 | 43 | :title="chip" |
|
47 | 47 | </v-chip-group> |
48 | 48 | </v-row> |
49 | 49 | <component |
50 | | - v-if="step_index == current_step_index" |
51 | | - :key="step_index" |
52 | | - :is="steps[step_index].component.component_name" |
53 | | - v-bind="steps[step_index].component.component_options" |
| 50 | + v-if="props.step_index == props.active_step_index" |
| 51 | + :key="props.step_index" |
| 52 | + :is="props.step.component.component_name" |
| 53 | + v-bind="props.step.component.component_options" |
54 | 54 | @update_values="update_values_event" |
55 | | - @increment_step="increment_step" |
56 | | - @decrement_step="decrement_step" |
| 55 | + @reset_values="emit('reset_values')" |
| 56 | + @increment_step="increment_step()" |
| 57 | + @decrement_step="decrement_step()" |
57 | 58 | /> |
58 | 59 | </v-stepper-content> |
59 | 60 | </template> |
60 | 61 |
|
61 | 62 | <script setup> |
| 63 | + const emit = defineEmits(["reset_values"]) |
| 64 | +
|
62 | 65 | function truncate(text, maxLength) { |
63 | 66 | if (text.length > maxLength) { |
64 | 67 | return text.slice(0, maxLength) + "..." |
|
68 | 71 |
|
69 | 72 | const props = defineProps({ |
70 | 73 | step_index: { type: Number, required: true }, |
| 74 | + active_step_index: { type: Number, required: true }, |
| 75 | + step: { type: Object, required: true }, |
71 | 76 | }) |
72 | 77 |
|
73 | | - const stepper_tree = inject("stepper_tree") |
74 | | - const { current_step_index, steps } = toRefs(stepper_tree) |
75 | | -
|
76 | 78 | function set_current_step(step_index) { |
77 | 79 | stepper_tree.current_step_index = step_index |
78 | 80 | } |
79 | 81 |
|
80 | 82 | function update_values_event(keys_values_object) { |
81 | 83 | for (const [key, value] of Object.entries(keys_values_object)) { |
82 | 84 | stepper_tree[key] = value |
| 85 | + console.log("key", key) |
| 86 | + console.log("value", value) |
| 87 | + console.log("stepper_tree[key]", stepper_tree[key]) |
83 | 88 | } |
84 | 89 | } |
85 | 90 |
|
|
0 commit comments