resovled binding issue

main
rYeti 2023-05-11 16:30:42 +02:00
parent 831f7c4ad1
commit d305af0547
2 changed files with 32 additions and 18 deletions

6
TODOS Normal file
View File

@ -0,0 +1,6 @@
for stase management:
1. Klick auf Übung macht neuen Eintrag in der UserState mit dem Excercise Namen + benötigten Feldern in currentEdit.
2. Wenn CurrentEdit gesetzt zeig die Set Optionen an.
3. Speichere die Sets in User.Chest
4. Cleare den CurrentEdit
5. Display oben was Eingetragen wurde in User.Chest

View File

@ -3,37 +3,43 @@
<div class="w-2/3 mx-auto">
<div class="warmup-sets mt-12 w-2/3">
<label>Warm-Up Sets</label>
<button @click="warmUpAddSet()" class="add-btn bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded ml-5">Add</button>
<div v-for="warmupset in warmUpInput.warmUpSets" class="item" :key="warmupset">
{{ warmupset }}
<input name="warmupweight" class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none focus:border-sky-500 focus:ring-sky-500 block rounded-md sm:text-sm focus:ring-1" placeholder="Weight in Kg" />
<button @click="warmUpAddSet()" class="add-btn bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-2 rounded ml-5">Add</button>
<div>
<div v-for="warmUpSet in warmUpInput.warmUpSets" class="item flex justify-smart mt-1">
{{ warmUpSet }}
<div class="ml-3">
<input v-model="warmUpSets" class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none focus:border-sky-500 focus:ring-sky-500 block rounded-md sm:text-sm focus:ring-1" placeholder="Weight in Kg"/>
</div>
<label class="ml-3 mt-2">Reps</label>
<div class="ml-3">
<input v-model="warmUpReps" class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none focus:border-sky-500 focus:ring-sky-500 block rounded-md sm:text-sm focus:ring-1" placeholder="Reps">
</div>
</div>
</div>
<div class="working-set mt-5">
<label>Working Sets</label>
<button @click="workingAddSet()" class="add-btn bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded ml-7">Add</button>
<button @click="workingAddSet()" class="add-btn bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-2 rounded ml-7">Add</button>
<div>
<div v-for="(workingset, index) in workingInput.workingSets" class="item flex justify-smart mt-3" :key="index">
<div v-for="workingset in workingInput.workingSets" class="item flex justify-smart mt-1">
{{ workingset }}
<div class="ml-3">
<input v-model="workingInput.workingSets" class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none focus:border-sky-500 focus:ring-sky-500 block rounded-md sm:text-sm focus:ring-1" placeholder="Weight in Kg"/>
<input v-model="workingSets" class="mt-1 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none focus:border-sky-500 focus:ring-sky-500 block rounded-md sm:text-sm focus:ring-1" placeholder="Weight in Kg"/>
</div>
<label>Reps</label>
<label class="ml-3 mt-2">Reps</label>
<div class="ml-3">
<input v-model="workingInput.workingReps" class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none focus:border-sky-500 focus:ring-sky-500 block rounded-md sm:text-sm focus:ring-1" placeholder="Reps">
<input v-model="workingReps" class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none focus:border-sky-500 focus:ring-sky-500 block rounded-md sm:text-sm focus:ring-1" placeholder="Reps">
</div>
</div>
</div>
</div>
<button @click="addWeight()" class="add-btn bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded mt-5">Save</button>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue';
import { useWeightStore } from '@/stores/storeWeight';
let warmUpSetCount = 0;
@ -41,12 +47,14 @@ let workingSetCount = 0;
const weight = useWeightStore();
let warmUpInput = {
const warmUpInput = ref([]);
warmUpInput.value = {
warmUpSets: [],
warmUpReps: []
}
let workingInput = {
const workingInput = ref([]);
workingInput.value = {
workingSets: [],
workingReps: []
}
@ -54,9 +62,9 @@ let workingInput = {
const warmUpAddSet = () => {
const newWarmUpSet = {
id: warmUpSetCount++,
content: warmUpSetCount + ". Set"
content: warmUpSetCount.toString().concat('. Set')
};
warmUpInput.warmUpSets.push(newWarmUpSet.content);
warmUpInput.value.warmUpSets.push(newWarmUpSet.content);
console.log(warmUpInput.warmUpSets);
};
@ -65,7 +73,7 @@ const workingAddSet = () => {
id: workingSetCount++,
content: workingSetCount + ". Set"
};
workingInput.workingSets.push(newWorkingSet.content);
workingInput.value.workingSets.push(newWorkingSet.content);
console.log(workingInput);
};