
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
vue-suggestion
Advanced tools
Suggestion list input for Vue.js, inspired by v-autocomplete.
Your search engine, your CSS, your everything...
yarn add vue-suggestion
npm i --save vue-suggestion
CSS
to your project:
import 'vue-suggestion/dist/vue-suggestion.css';
vue-suggestion
into your Vue component and use it as normal:
<template>
...
<vue-suggestion></vue-suggestion>
...
<template>
<script>
import VueSuggestion from 'vue-suggestion'
export default {
...
components: {
VueSuggestion
}
}
</script>
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 |
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 |
Name | Description |
---|---|
searchSlot | Next to the input, for the custom search icon or button... |
Just overwrite their css classes:
.vue-suggestion
.vue-suggestion-input-group
.vue-suggestion-input
.vue-suggestion-list
.vue-suggestion-list-item
&.vue-suggestion-item-active
<template>
<vue-suggestion :items="items"
v-model="item",
:setLabel="setLabel",
:itemTemplate="itemTemplate",
@onInputChange="inputChange",
@onItemSelected="itemSelected">
</vue-suggestion>
</template>
<script>
import itemTemplate from './item-template.vue';
export default {
data () {
return {
item: {},
items: [
{ id: 1, name: 'Golden Retriever'},
{ id: 2, name: 'Cat'},
{ id: 3, name: 'Squirrel'},
],
itemTemplate,
}
},
methods: {
itemSelected (item) {
this.item = item;
},
setLabel (item) {
return item.name;
},
inputChange (text) {
// your search method
this.items = items.filter(item => item.name.contains(text));
// now `items` will be showed in the suggestion list
},
},
};
</script>
ItemTemplate example:
<template>
<div>
<b>#{{item.id}}</b>
<span>{{ item.name }}</span>
</div>
</template>
<script>
export default {
props: {
item: { required: true },
}
}
</script>
# install dependencies
$ yarn/npm install
# compile demo for development
$ yarn/npm dev
# open Browser and start serve in demo
$ yarn/npm demo:open
# compile dist demo
$ yarn/npm dist:demo
# compile dist
$ yarn/npm dist
made with ❤ by Steven.
FAQs
Suggestion list input with Vue
The npm package vue-suggestion receives a total of 605 weekly downloads. As such, vue-suggestion popularity was classified as not popular.
We found that vue-suggestion demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.