When value is empty/null, the placeholder is shown
The placeholder style should be different from the style of a value
The span containing the placeholder has no additional CSS class, hence we cannot style it differently.
Vue code:
<vue-multiselect
track-by="id"
label="label"
v-model="newItem.role"
placeholder="R么le du repr茅sentant l茅gal dans la structure"
:options="legalRepresentativeRoles"></vue-multiselect>
Rendered in browser:
//...
<span><span class="multiselect__single">
R么le du repr茅sentant l茅gal dans la structure
</span></span>
</div>
//...
Working code (but very verbose when you have lots of selects):
<vue-multiselect
track-by="id"
label="label"
v-model="newItem.role"
:options="legalRepresentativeRoles">
<template slot="placeholder">
<span class="multiselect__placeholder">R么le du repr茅sentant l茅gal dans la structure</span>
</template>
</vue-multiselect>
Same issue. Why is this closed? Why are their remnants of a class existing "multiselect__placeholder" and it not being applied to an actual placeholder.
I did not get it either :/
@williamabbott please look into the source code:
<span
v-if="isPlaceholderVisible"
class="multiselect__placeholder"
@mousedown.prevent="toggle">
<slot name="placeholder">
{{ placeholder }}
</slot>
</span>
As you can see, the .multiselect__placeholder class is still there and applied. However, when the component is searchable we鈥檙e using the native placeholder of an input. I imagine the latter could be working different (ditching the native placeholder all together). A PR is welcome in this case.
@shentao when I focus the multiselect, I can see it reverts to displaying the native placeholder (this is styled, as I want, as per other inputs) but in an unfocused state, it is using:
<span class="multiselect__single">
My placeholder
</span>
Please provide a reproduction fiddle.
I will accept a PR that improves this :)
I don't know about anyone else in this thread but my issue was resolved by bumping version 2.1.0 -> 2.1.3
Thanks, it' helpful.
Most helpful comment
Working code (but very verbose when you have lots of selects):