Skip to content

Commit

Permalink
fix(Select): disable placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Mar 1, 2022
1 parent 7737242 commit 7723704
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions docs/pages/examples.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand All @@ -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"
Expand Down Expand Up @@ -253,7 +254,7 @@ const form = reactive({
notification: 'email',
notifications: [],
terms: false,
personId: people[0].id,
personId: null,
person: ref(people[0])
})
Expand Down
6 changes: 5 additions & 1 deletion src/runtime/components/forms/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<select
:id="name"
:name="name"
:value="modelValue"
:required="required"
:disabled="disabled"
:class="selectClass"
Expand All @@ -20,6 +21,7 @@
:key="`${childOption[valueAttribute]}-${index}-${index2}`"
:value="childOption[valueAttribute]"
:selected="childOption[valueAttribute] === normalizedValue"
:disabled="option.disabled"
v-text="childOption[textAttribute]"
/>
</optgroup>
Expand All @@ -28,6 +30,7 @@
:key="`${option[valueAttribute]}-${index}`"
:value="option[valueAttribute]"
:selected="option[valueAttribute] === normalizedValue"
:disabled="option.disabled"
v-text="option[textAttribute]"
/>
</template>
Expand Down Expand Up @@ -154,7 +157,8 @@ export default {
return [
{
[props.valueAttribute]: null,
[props.textAttribute]: props.placeholder
[props.textAttribute]: props.placeholder,
disabled: true
},
...normalizedOptions.value
]
Expand Down

1 comment on commit 7723704

@vercel
Copy link

@vercel vercel bot commented on 7723704 Mar 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.