|
17 | 17 | <table class="table stress-table table-bordered mb-0">
|
18 | 18 | <tbody>
|
19 | 19 | <tr>
|
20 |
| - <td v-for="(stressBox, index) in [ 1, 2, 3, 4 ]" :key="stressBox"> |
| 20 | + <td v-for="(stressBox, index) in stressSlots" :key="stressBox"> |
21 | 21 | <BFormCheckbox
|
22 | 22 | v-model="physicalStress[index]"
|
23 | 23 | class="me-1"
|
|
41 | 41 | <table class="table stress-table table-bordered mb-0">
|
42 | 42 | <tbody>
|
43 | 43 | <tr>
|
44 |
| - <td v-for="(stressBox, index) in [ 1, 2, 3, 4 ]" :key="stressBox"> |
| 44 | + <td v-for="(stressBox, index) in stressSlots" :key="stressBox"> |
45 | 45 | <BFormCheckbox
|
46 | 46 | v-model="mentalStress[index]"
|
47 | 47 | class="me-1"
|
|
78 | 78 | import RpgkCard from '../../ui/rpgkCard.vue';
|
79 | 79 |
|
80 | 80 | //------------------------------------------------------------------------------------------------------------------
|
81 |
| - // Component Definition |
| 81 | + // State |
82 | 82 | //------------------------------------------------------------------------------------------------------------------
|
83 | 83 |
|
| 84 | + const stressSlots = [ 1, 2, 3, 4 ]; |
| 85 | + |
| 86 | + const physicalStress = defineModel<FateStress>('physical'); |
| 87 | + const mentalStress = defineModel<FateStress>('mental'); |
| 88 | + |
84 | 89 | interface Props
|
85 | 90 | {
|
86 |
| - physical : FateStress; |
87 |
| - mental : FateStress; |
88 | 91 | skills : FateSkill[];
|
89 | 92 | readonly : boolean;
|
90 | 93 | }
|
91 | 94 |
|
92 | 95 | const props = defineProps<Props>();
|
93 | 96 |
|
94 | 97 | const emit = defineEmits<{
|
95 |
| - 'update:physical' : [val : FateStress]; |
96 |
| - 'update:mental' : [val : FateStress]; |
97 |
| - 'save' : []; |
| 98 | + save : []; |
98 | 99 | }>();
|
99 | 100 |
|
100 | 101 | //------------------------------------------------------------------------------------------------------------------
|
|
103 | 104 |
|
104 | 105 | const readonly = computed(() => props.readonly);
|
105 | 106 |
|
106 |
| - const physicalStress = computed<FateStress>({ |
107 |
| - get() { return props.physical; }, |
108 |
| - set(val) { emit('update:physical', val); }, |
109 |
| - }); |
110 |
| - |
111 |
| - const mentalStress = computed<FateStress>({ |
112 |
| - get() { return props.mental; }, |
113 |
| - set(val) { emit('update:physical', val); }, |
114 |
| - }); |
115 |
| - |
116 | 107 | const totalPhysicalBoxes = computed(() =>
|
117 | 108 | {
|
118 | 109 | const physique = props.skills.find((skill) => skill.name === 'Physique');
|
|
0 commit comments