Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typeahead with Vue.js 2.0 [closed]

Total Vue noob here. Just wanted a typeahead component for Vue. Bootstrap has one, but I have no idea how to integrate the two!

And the only options I can find are either for Vue 1.x only or terribly documented (and the main effort to port Bootstrap components to Vue 2.x doesn't appear to include typeahead.)

like image 506
Ian Grainger Avatar asked Oct 26 '16 15:10

Ian Grainger


2 Answers

I've been a user of vue-strap, and it is not maintaining for a long time... (both vue 1 version and vue 2 fork)

check this out (created by myself): https://uiv.wxsm.space/typeahead/

(A simple but elegant typeahead implementation with Vue 2 & Bootstrap 3)

Install:

$ npm install uiv --save

Example usage:

<template>
  <section>
    <label for="input">States of America:</label>
    <input id="input" class="form-control" type="text" placeholder="Type to search...">
    <typeahead v-model="model" target="#input" :data="states" item-key="name"/>
  </section>
</template>
<script>
  import {Typeahead} from 'uiv'
  import states from '../../assets/data/states.json'

  export default {
    components: {Typeahead},
    data () {
      return {
        model: '',
        states: states.data
      }
    }
  }
</script>
<!-- typeahead-example.vue -->
like image 103
wxsm Avatar answered Nov 17 '22 05:11

wxsm


Check out this component:

https://github.com/pespantelis/vue-typeahead

Also, there is a great collection of vue components already:

https://vuecomponents.com

like image 23
codegeek Avatar answered Nov 17 '22 07:11

codegeek