C
C
ceeed2021-08-10 00:33:50
Vue.js
ceeed, 2021-08-10 00:33:50

How to make placeholder on SELECT?

I don't understand how to make placeholder on select. I found an example which is in the code, but it does not work.

<vSelect
        class="select_change select-gradient"
          v-model="selectedDirection"
          :options="directionOptions"
          @input="setDirection"
        >
        <option class="select__placeholder" value="" disabled selected>Выберите из списка</option>
        </vSelect>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2021-08-10
@ceeed

Add a slot to the component: Accordingly, when using the component, you can pass something to this slot:
<slot name="placeholder"></slot>

<template #placeholder>
  <option value="" disabled>давай, выбирай</option>
</template>

https://jsfiddle.net/zc53rugL/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question