Skip to content

Commit

Permalink
fix(SelectCustom): handle placeholder when value is null
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Feb 15, 2022
1 parent 1319396 commit 4e0d23e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/runtime/components/forms/SelectCustom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<input :value="modelValue" :required="required" class="absolute inset-0 w-px opacity-0 cursor-default">

<ListboxButton :class="selectCustomClass">
<span class="block truncate">{{ modelValue[textAttribute] }}</span>
<span v-if="modelValue && modelValue[textAttribute]" class="block truncate">{{ modelValue[textAttribute] }}</span>
<span v-else class="block truncate u-text-gray-400">{{ placeholder }}</span>
<span :class="iconWrapperClass">
<Icon name="heroicons-solid:selector" :class="iconClass" aria-hidden="true" />
</span>
Expand Down Expand Up @@ -66,6 +67,10 @@ const props = defineProps({
type: Boolean,
default: false
},
placeholder: {
type: String,
default: null
},
size: {
type: String,
default: 'md',
Expand Down

1 comment on commit 4e0d23e

@vercel
Copy link

@vercel vercel bot commented on 4e0d23e Feb 15, 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.