Member-only story

Vue Select — Pagination, Infinite Scrolling, and Disabling Selections

John Au-Yeung
3 min readJan 7, 2021

--

Photo by Jimmy Chang on Unsplash

To make dropdowns easier, we can use the Vue Select plugin to add the dropdown.

It can do much more than the select element.

In this article, we’ll look at how to use the vue-select package to make more complex dropdowns.

Selectable Prop

We can set which options are selected able with the selectable prop.

For example, we can write:

<template>
<div id="app">
<v-select
placeholder="Choose fruit"
:options="options"
:selectable="option => option !== 'grape'"
></v-select>
</div>
</template>
<script>
export default {
name: "App",
data() {
return {
options: ["apple", "orange", "grape"]
};
}
};
</script>

We set the selectable prop to a function that returns the condition for the items that we want to disable.

Therefore, we disable the 'grape' choice in the dropdown.

The placeholder has the placeholder for the dropdown.

Limiting the Number of Selections

We can limit the number of selections with the selectable prop.

--

--

No responses yet