我想在laravel + vue js中创建一个多选下拉菜单。
有人可以和我分享一个例子吗?

<label>Difficulty Level</label>
                        <select
                            v-model="form.difficulty_level"
                            name="difficulty_level"
                            placeholder="Enter  Difficulty Level"
                            class="form-control"
                            :class="{
                                'is-invalid': form.errors.has(
                                    'difficulty_level'
                                )
                            }"
                        >
                            <option value="null" disabled selected
                                >Select Difficulty</option
                            >
                            <option value="Easy">Easy</option>
                            <option value="Medium">Medium</option>
                            <option value="Hard">Hard</option>
                        </select>

最佳答案

HTML

<div>
<label class="typo__label">Single select</label>
<multiselect v-model="value" :options="options" :searchable="false" :close-on-
select="false" :show-labels="false" placeholder="Pick a value"></multiselect>
<pre class="language-json"><code>{{ value  }}</code></pre>
</div>
javascript
import Multiselect from 'vue-multiselect'

export default {
components: {
Multiselect
},
data () {
return {
   value: '',
  options: ['Select option', 'options', 'selected', 'mulitple', 'label', 'searchable',
  'clearOnSelect', 'hideSelected', 'maxHeight', 'allowEmpty', 'showLabels',
  'onChange', 'touched']
}
}
}

关于laravel - 如何在vuejs中使用multiselect?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/60410051/

10-13 00:55