...
<el-select
v-if="props.secondType"
v-model="modelText"
placeholder="Выберите предмет"
@change="changeVal"
>
<el-option
v-for="item in props.secondTypeItems"
:key="item.id"
:label="item.value"
:value="item.id"
>
{{ item.value }}
</el-option>
</el-select>
<el-select
v-else="props.thirdType"
v-model="modelText"
placeholder="Выберите активность"
@change="changeVal"
>
<el-option
v-for="event in props.thirdTypeEvents"
:key="event.desc"
:label="event.name"
:value="event.desc"
>
{{ event.name }}
</el-option>
</el-select>
...
const options = computed(() => {
if (props.secondType)
return props.secondTypeItems.map(({ id, value}) => ({
label: value,
value: id
}));
if (props.thirdType)
return props.thirdTypeEvents.map(({ desc, name }) => ({
label: name,
value: desc
}));
// ...
return [];
});
<el-select
v-model="modelText"
placeholder="Выберите предмет"
@change="changeVal"
>
<el-option
v-for="{ label, value} in options"
:key="value"
:label="label"
:value="value"
>
{{ label }}
</el-option>
</el-select>