Skip to content

Commit 3977de2

Browse files
committed
minor cleanup using new defineModel macro.
1 parent 1d5012e commit 3977de2

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

src/client/components/systems/fate/stressCard.vue

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<table class="table stress-table table-bordered mb-0">
1818
<tbody>
1919
<tr>
20-
<td v-for="(stressBox, index) in [ 1, 2, 3, 4 ]" :key="stressBox">
20+
<td v-for="(stressBox, index) in stressSlots" :key="stressBox">
2121
<BFormCheckbox
2222
v-model="physicalStress[index]"
2323
class="me-1"
@@ -41,7 +41,7 @@
4141
<table class="table stress-table table-bordered mb-0">
4242
<tbody>
4343
<tr>
44-
<td v-for="(stressBox, index) in [ 1, 2, 3, 4 ]" :key="stressBox">
44+
<td v-for="(stressBox, index) in stressSlots" :key="stressBox">
4545
<BFormCheckbox
4646
v-model="mentalStress[index]"
4747
class="me-1"
@@ -78,23 +78,24 @@
7878
import RpgkCard from '../../ui/rpgkCard.vue';
7979

8080
//------------------------------------------------------------------------------------------------------------------
81-
// Component Definition
81+
// State
8282
//------------------------------------------------------------------------------------------------------------------
8383

84+
const stressSlots = [ 1, 2, 3, 4 ];
85+
86+
const physicalStress = defineModel<FateStress>('physical');
87+
const mentalStress = defineModel<FateStress>('mental');
88+
8489
interface Props
8590
{
86-
physical : FateStress;
87-
mental : FateStress;
8891
skills : FateSkill[];
8992
readonly : boolean;
9093
}
9194

9295
const props = defineProps<Props>();
9396

9497
const emit = defineEmits<{
95-
'update:physical' : [val : FateStress];
96-
'update:mental' : [val : FateStress];
97-
'save' : [];
98+
save : [];
9899
}>();
99100

100101
//------------------------------------------------------------------------------------------------------------------
@@ -103,16 +104,6 @@
103104

104105
const readonly = computed(() => props.readonly);
105106

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-
116107
const totalPhysicalBoxes = computed(() =>
117108
{
118109
const physique = props.skills.find((skill) => skill.name === 'Physique');

0 commit comments

Comments
 (0)