1.0.3 • Published 6 years ago

vue-suggestion-list v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

vue-suggestion-list

Simple to use, mobile-friendly suggestion list using native html5 datalist

Install

npm install vue-suggestion-list --save

How to use

Include plugin in your project.

import SuggestionList from 'vue-suggestion-list';

/*
 Use as global component 
 */
Vue.use(SuggestionList);

/*
 Or as local component
 */
const vue = new Vue({
    components:{
        SuggestionList
    }
});

Create list

<suggestion-list :items="items" v-model="item"></suggestion-list>

Items must be an array of objects in the below format

[
    {text: 'First', value: 1},
    {text: 'Two', value: 2},
    {text: 'Three', value: 3}
]

Note: Suggestion input box is given with two classes, form-control,js-suggestion-input and suggestion datalist is given with a default class of js-suggestion-list. So that you can applay custom styles on js-suggestion-input and js-suggestion-list classes.


Properties

NameRequiredTypeDefaultDescription
itemstrueArrayList items in the format [{value:'value',text:'text'}]

Example

<template>
  <list :items="items" v-model="value"></list>
</template>
<script>
export default {
  name: 'ExampleList',
  data () {
        return {
            value: '2',
            items: [
                {text: 'First', value: 1},
                {text: 'Two', value: 2},
                {text: 'Three', value: 3}
            ]
        }   
  },
 
}
</script>
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago