|
|
|
@ -1,15 +1,10 @@
|
|
|
|
<script setup>
|
|
|
|
<script setup>
|
|
|
|
import { onMounted, ref, watch, } from 'vue'
|
|
|
|
import { onMounted, ref, watch, toRefs } from 'vue'
|
|
|
|
const emit = defineEmits(['update'])
|
|
|
|
const emit = defineEmits(['update'])
|
|
|
|
const props = defineProps(['categories', 'currentWorkingCategoryID'])
|
|
|
|
const props = defineProps(['instruments', 'categories', 'currentWorkingCategoryID'])
|
|
|
|
const instruments = ref([])
|
|
|
|
const { currentWorkingCategoryID } = toRefs(props);
|
|
|
|
const currentWorkingCategoryID = ref(props.currentWorkingCategoryID)
|
|
|
|
|
|
|
|
const chosenInstrument = ref('clarinet')
|
|
|
|
const chosenInstrument = ref('clarinet')
|
|
|
|
for(let category of props.categories){
|
|
|
|
|
|
|
|
if(!instruments.value.includes(category.instrument)){
|
|
|
|
|
|
|
|
instruments.value.push(category.instrument)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const handleSelection = (event)=>{
|
|
|
|
const handleSelection = (event)=>{
|
|
|
|
emit('update', event.target.value)
|
|
|
|
emit('update', event.target.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -21,22 +16,21 @@
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<select v-model="chosenInstrument">
|
|
|
|
<select v-model="chosenInstrument">
|
|
|
|
<option v-for="instrument in instruments" v-bind:value="instrument">
|
|
|
|
<option v-for="instrument in props.instruments" v-bind:value="instrument.name">
|
|
|
|
{{instrument}}
|
|
|
|
{{instrument.name}}
|
|
|
|
</option>
|
|
|
|
</option>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select
|
|
|
|
<select
|
|
|
|
@change="handleSelection"
|
|
|
|
@change="handleSelection"
|
|
|
|
v-for="instrument in instruments"
|
|
|
|
v-for="instrument in props.instruments"
|
|
|
|
:key="instrument"
|
|
|
|
|
|
|
|
v-model="props.currentWorkingCategoryID"
|
|
|
|
v-model="props.currentWorkingCategoryID"
|
|
|
|
v-show="instrument == chosenInstrument">
|
|
|
|
v-show="instrument.name == chosenInstrument">
|
|
|
|
<option
|
|
|
|
<option
|
|
|
|
v-bind:value="category.id"
|
|
|
|
v-bind:value="category.id"
|
|
|
|
v-for="category in props.categories"
|
|
|
|
v-for="category in props.categories"
|
|
|
|
:key="category.id"
|
|
|
|
:key="category.id"
|
|
|
|
v-show="category.instrument == instrument"
|
|
|
|
v-show="category.instrument == instrument.name"
|
|
|
|
:selected="category.instrument == instrument">
|
|
|
|
:selected="category.instrument == instrument.name">
|
|
|
|
{{category.category}}
|
|
|
|
{{category.category}}
|
|
|
|
</option>
|
|
|
|
</option>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|