vue-suggestion
Suggestion list input for Vue.js, inspired by v-autocomplete.
Your search engine, your CSS, your everything...
Installation
- yarn:
yarn add vue-suggestion
- npm:
npm i --save vue-suggestion
Usage
- Import default
CSS
to your project: - Import
vue-suggestion
into your Vue component and use it as normal:
!! You can also use it as a custom field of vue-form-generator.
Props
Property value | Type | Default value | Description |
---|---|---|---|
itemTemplate | vue component | Template for item in suggestion list | |
setLabel | function | Value of choosen input, be shown in the input | |
items | Array | [] |
Suggestion array, should be updated dynamically after onInputChange() |
minLen | Interger | 2 |
Minimun number of characters inputted to start searching |
disabled | Boolean | false |
Disable the input |
placeholder | String | '' |
Placeholder of the input |
Events
Property value | Arguments | Description |
---|---|---|
onInputChange | String | Fires when the input changes with the argument is the current input text. |
onItemSelected | Object | Fires when user selects a suggestion |
Slots
Name | Description |
---|---|
searchSlot | Next to the input, for the custom search icon or button... |
Style
Just overwrite their css classes:
Example
ItemTemplate example: