fix(Select): disable placeholder

This commit is contained in:
Benjamin Canac
2022-03-01 17:01:48 +01:00
parent 77372423d8
commit 7723704f79
2 changed files with 8 additions and 3 deletions

View File

@@ -175,7 +175,7 @@
Card:
</div>
<UCard body-class="flex" @submit.prevent="onSubmit">
<UCard body-class="flex">
<div class="flex-1 px-4 py-5 sm:p-6 space-y-3">
<UFormGroup label="Email" name="email" required>
<UInput v-model="form.email" type="email" name="email" required icon="heroicons-outline:mail" />
@@ -190,6 +190,7 @@
v-model="form.personId"
name="person"
:options="people"
placeholder="Select a person"
text-attribute="name"
value-attribute="id"
icon="heroicons-outline:user"
@@ -253,7 +254,7 @@ const form = reactive({
notification: 'email',
notifications: [],
terms: false,
personId: people[0].id,
personId: null,
person: ref(people[0])
})

View File

@@ -3,6 +3,7 @@
<select
:id="name"
:name="name"
:value="modelValue"
:required="required"
:disabled="disabled"
:class="selectClass"
@@ -20,6 +21,7 @@
:key="`${childOption[valueAttribute]}-${index}-${index2}`"
:value="childOption[valueAttribute]"
:selected="childOption[valueAttribute] === normalizedValue"
:disabled="option.disabled"
v-text="childOption[textAttribute]"
/>
</optgroup>
@@ -28,6 +30,7 @@
:key="`${option[valueAttribute]}-${index}`"
:value="option[valueAttribute]"
:selected="option[valueAttribute] === normalizedValue"
:disabled="option.disabled"
v-text="option[textAttribute]"
/>
</template>
@@ -154,7 +157,8 @@ export default {
return [
{
[props.valueAttribute]: null,
[props.textAttribute]: props.placeholder
[props.textAttribute]: props.placeholder,
disabled: true
},
...normalizedOptions.value
]