switch to first category of instrument when instrument is changed

practiced-songs
Matthew Huntington 1 year ago
parent 8aaa97fbb8
commit 1b2b28d451

@ -1,5 +1,5 @@
<script setup>
import { onMounted, ref } from 'vue'
import { watch, onMounted, ref } from 'vue'
import Summary from './components/summary.vue'
import ShowCategory from './components/show_category.vue'
@ -30,6 +30,12 @@
currentWorkingInstrument.value = instruments.value.find(instrument => instrument.name === currentWorkingCategory.value.instrument)
}
onMounted(loadData)
watch(currentWorkingInstrument, () => {
console.log(currentWorkingCategory);
console.log(currentWorkingInstrument);
currentWorkingCategory.value = categories.value.find(category => category.instrument === currentWorkingInstrument.value.name)
})
</script>
<template>

Loading…
Cancel
Save