1.0.0 • Published 4 years ago

vue-sug v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

you can create optional your input with your suggests

autocomplete will be added soon

Demo: http://byParsa.me/Plugins/vue-sug

vue-sug

Install

npm install vue-sug --save

Import

Globally :

Import plugin in your main.js file globally.

import vueSug from  'vue-sug';
Vue.use(vueSug)
/*

Example:

Vue.use(vueSug, { color: "white" 
, bgColor:"red"
	...
  })

...

<vue-sug :color="'white'"></vue-sug>

*/

Locally :

Import plugin in your component directly.

import { vueSuggestion } from  'vue-sug'

export  default {

    components:{
	    vueSuggestion
	}
}
<vue-suggestion :color="'white'"></vue-suggestion>

Props:

NameTypeDefaultDescription
suggestsString*inExamplecolor define input text and icon color
colorStringgraycolor define input text and icon color
bgColorStringtransparentbgColor property allows you change the background color if you want
startAtNumber3startAt property shows after how many charecters suggestions start
placeHolderStringEnter what you wantplaceHolder property allows you change the input placeholder
iconClassStringfa fa-searchicon property allows you to use the fontawesome icons with class name , you can use custom classes too

EventEmmiters

@click > at icon click @itemClick > at suggests click

:suggests structure

Example:

<template>
	<div>
	/* imported globally */
		<vue-sug
		:color="'white'"
		:suggests="yourArray"
		v-model="string"
		@click="search()"
		@itemClick="select($index)"
		></vue-sug>
	</div>
</template>
<script>
export  default {
	data(){
		return{
			string:'',
			yourArray:[
				{
					sugTitle:'FirstItem',
					sugDesc: 'description 1',
					sugStatus:'status1',
					//More values ..
				} , {
					sugTitle:'SecondItem',
					sugDesc: 'description 2',
					sugStatus:'status2',
					//More values ..
				} , {
					sugTitle:'ThirdItem',
					sugDesc: 'description 2',
					sugStatus:'status3',
					//More values ..
				}
						]
					}
				}
			},
	methods:{
		search(){
		//this method triggered when you click on icon
		}
		select(i){
		//this method triggered when you click on a suggest and returns index  of suggest
		}
	}
</script>
1.0.0

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago