I'm attempting to automatically have an option selected if the "selected" property is present on the option object.
Here is my code snippet:
<template>
<select v-model="model" :placeholder="placeholder">
<option v-for="option in options" :value="option.value" :selected="option.selected">{{option.label}}</option>
</select>
</template>
<script>
export default {
props: {
model: {
default: null
},
placeholder: {
default: null
},
options: {
default: null
}
}
};
</script>
The selected attribute appears to be set correctly, as I can see it in the element explorer. However, it seems that this method doesn't fully work since the "selected" property of the option remains false when checked in the element. How can I properly set the selected property of the option element?