0.3.17 • Published 7 years ago

vue-autocompleter v0.3.17

Weekly downloads
42
License
-
Repository
-
Last release
7 years ago

vue-autocompleter

yet another autocomplete plugin

Installing

# using yarn
yarn add vue-autocompleter
# using npm
npm install --save vue-autocompleter
# in main.js for example
// ...
import Autocomplete 'vue-autocompleter'

Usage

<Autocomplete
  :placeholder=<placeholder>
  :limit=<limit>
  :transform=<path>
  :api=<api>
  :param=<param>
  :method=<method>
  :closeOnSelect=<closeOnSelect>
  :resetOnSelect=<resetOnSelect>
  :optionsStyles=<optionsStyles>
  :optionStyles=<optionStyles>
  :inputStyles=<inputStyles>
  :optionsClass=<optionsClass>
  :optionClass=<optionClass>
  :inputClass=<inputClass>
  v-model=<msg>
  >
</Autocomplete>

Documentation

PropTypeDescriptionDefault value
placeholderStringinput PlaceholderPlaceholder
limitNumberresults limit5
transformFunction, Stringtransformer function to map response to the desired option, or just a string representing key to grap from responsenull
apiStringapi endpointnull
paramStringparam for search valueq (demo)
otherParamsObjectother params passed with the request{}
methodStringApi http methodGET
closeOnSelectBooleanClose dropdown once select an elementtrue
resetOnSelectBooleanReset dropdown once select an elementtrue
inputStylesObjectinline styles for input{}
optionsStylesObjectinline styles for options{}
optionStylesObjectinline styles for option item{}
inputClassStringinput classnull
optionsClassStringinput classnull
optionClassStringinput classnull
beforeSearchFunctionfunctions gets called before sending api request, accepts two params (url, query)null
filterMethodFunctionmethod to be used to filter provided options (should return boolean)null
afterSearchFunctionfunctions called after api response, accepts one param (response)null
beforeUpdateValueFunctionfunctions called before update value, accepts one param (value)null
shouldUpdateValueFunctionfunctions called before update value, accepts one param (value) and returns boolean wether to update value or notnull
afterUpdateValueFunctionfunctions called after update value, accepts one param (value)null

Customize option

You can customize how the option will be displayed by adding your template

<!-- example -->
  <template  scope="{option, index}">
    <div class="option">
      <strong>{{index}}</strong>
      <span>{{option}}</span>
    </div>
  </template>

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

# run unit tests
npm run unit

# run e2e tests
npm run e2e

# run all tests
npm test
0.3.17

7 years ago

0.3.16

7 years ago

0.2.16

7 years ago

0.1.16

7 years ago

0.1.15

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.0

7 years ago

1.0.0

7 years ago