Placeholder support for #271
parent
81dc76760b
commit
b2a9a0dfc1
|
@ -7,7 +7,7 @@
|
|||
<input v-if="editable" type="text" class="p-dropdown-label p-inputtext" :disabled="disabled" @focus="onFocus" @blur="onBlur" :placeholder="placeholder" :value="editableInputValue" @input="onEditableInput"
|
||||
aria-haspopup="listbox" :aria-expanded="overlayVisible">
|
||||
<label v-if="!editable" :class="labelClass">
|
||||
<slot name="value" :value="value">
|
||||
<slot name="value" :value="value" :placeholder="placeholder">
|
||||
{{label}}
|
||||
</slot>
|
||||
</label>
|
||||
|
@ -425,7 +425,7 @@ export default {
|
|||
'p-dropdown-label p-inputtext',
|
||||
{
|
||||
'p-placeholder': this.label === this.placeholder,
|
||||
'p-dropdown-label-empty': (this.label === 'p-emptylabel' || this.label.length === 0)
|
||||
'p-dropdown-label-empty': !this.$scopedSlots['value'] && (this.label === 'p-emptylabel' || this.label.length === 0)
|
||||
}
|
||||
];
|
||||
},
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
<Dropdown v-model="selectedCity2" :options="cities" optionLabel="name" :editable="true"/>
|
||||
|
||||
<h3>Advanced with Templating, Filtering and Clear Icon</h3>
|
||||
<Dropdown v-model="selectedCar" :options="cars" optionLabel="brand" :filter="true" :showClear="true">
|
||||
<Dropdown v-model="selectedCar" :options="cars" optionLabel="brand" :filter="true" placeholder="Select a Car" :showClear="true">
|
||||
<template #value="slotProps">
|
||||
<div class="p-dropdown-car-value" v-if="slotProps.value">
|
||||
<img :alt="slotProps.value.brand" :src="'demo/images/car/' + slotProps.value.brand + '.png'" />
|
||||
<span>{{slotProps.value.brand}}</span>
|
||||
</div>
|
||||
<span v-else>
|
||||
Select a Car
|
||||
{{slotProps.placeholder}}
|
||||
</span>
|
||||
</template>
|
||||
<template #option="slotProps">
|
||||
|
|
|
@ -43,14 +43,14 @@ data() {
|
|||
<p>In addition the <i>value</i> template can be used to customize the selected value.</p>
|
||||
<CodeHighlight>
|
||||
<template v-pre>
|
||||
<Dropdown v-model="selectedCar" :options="cars" optionLabel="brand" :filter="true" :showClear="true">
|
||||
<Dropdown v-model="selectedCar" :options="cars" optionLabel="brand" :filter="true" placeholder="Select a Car" :showClear="true">
|
||||
<template #value="slotProps">
|
||||
<div class="p-dropdown-car-value" v-if="slotProps.value">
|
||||
<img :alt="slotProps.value.brand" :src="'demo/images/car/' + slotProps.value.brand + '.png'" />
|
||||
<span>{{slotProps.value.brand}}</span>
|
||||
</div>
|
||||
<span v-else>
|
||||
Select a Car
|
||||
{{slotProps.placeholder}}
|
||||
</span>
|
||||
</template>
|
||||
<template #option="slotProps">
|
||||
|
@ -294,13 +294,13 @@ data() {
|
|||
<Dropdown v-model="selectedCity2" :options="cities" optionLabel="name" :editable="true"/>
|
||||
|
||||
<h3>Advanced with Templating, Filtering and Clear Icon</h3>
|
||||
<Dropdown v-model="selectedCar" :options="cars" optionLabel="brand" :filter="true" :showClear="true">
|
||||
<Dropdown v-model="selectedCar" :options="cars" optionLabel="brand" :filter="true" placeholder="Select a Car" :showClear="true">
|
||||
<div class="p-dropdown-car-value" v-if="slotProps.value">
|
||||
<img :alt="slotProps.value.brand" :src="'demo/images/car/' + slotProps.value.brand + '.png'" />
|
||||
<span>{{slotProps.value.brand}}</span>
|
||||
</div>
|
||||
<span v-else>
|
||||
Select a Car
|
||||
{{slotProps.placeholder}}
|
||||
</span>
|
||||
<template #option="slotProps">
|
||||
<div class="p-dropdown-car-option">
|
||||
|
|
Loading…
Reference in New Issue