only single click needed on summary now

practiced-songs
Matthew Huntington 1 year ago
parent cbcae5b355
commit 88583ddbfb

@ -30,10 +30,6 @@
currentWorkingInstrument.value = instruments.value.find(instrument => instrument.name === currentWorkingCategory.value.instrument) currentWorkingInstrument.value = instruments.value.find(instrument => instrument.name === currentWorkingCategory.value.instrument)
} }
onMounted(loadData) onMounted(loadData)
watch(currentWorkingInstrument, () => {
currentWorkingCategory.value = categories.value.find(category => category.instrument === currentWorkingInstrument.value.name)
})
</script> </script>
<template> <template>

@ -2,9 +2,14 @@
const props = defineProps(['instruments', 'categories']) const props = defineProps(['instruments', 'categories'])
const currentWorkingCategory = defineModel('currentWorkingCategory') const currentWorkingCategory = defineModel('currentWorkingCategory')
const currentWorkingInstrument = defineModel('currentWorkingInstrument') const currentWorkingInstrument = defineModel('currentWorkingInstrument')
const selectFirstInstrumentOfCategory = () => {
currentWorkingCategory.value = props.categories.find(category => category.instrument === currentWorkingInstrument.value.name)
}
</script> </script>
<template> <template>
<select v-model="currentWorkingInstrument"> <select @change="selectFirstInstrumentOfCategory" v-model="currentWorkingInstrument">
<option :value="instrument" v-for="instrument in props.instruments"> <option :value="instrument" v-for="instrument in props.instruments">
{{instrument.name}} {{instrument.name}}
</option> </option>

Loading…
Cancel
Save