Tagged: vue js autocomplete example

Autocomplete with Search box in vuejs Demo 0

Autocomplete with Search box in vuejs Demo

Autocomplete with Search box in vuejs Demo

In this Post We Will Explain About is Autocomplete with Search box in vuejs Demo With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Vuejs Typeahead Auto Complete json Example

In this post we will show you Best way to implement vuejs select search, hear for Vuejs autocomplete ajax example with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Autocomplete field with search box in Vue.js

In this Example,First of all Add or Include External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priority set.After that Include your relevant CSS Class.

Include External Libs

https://unpkg.com/[email protected]/dist/vue.js
https://unpkg.com/[email protected]/dist/css/select2.min.css
https://unpkg.com/[email protected]/dist/js/select2.js
https://unpkg.com/[email protected]/dist/jquery.js

index.html

<div id="el"></div>
<!-- Devloped by https://pakainfo.com free download examples -->
<script type="text/x-template" id="live-template">
  <div>
    <p>Selected: {{ selected }}</p>
    <select2 :options="options" v-model="selected">
      <option disabled value="0">Select one</option>
    </select2>
  </div>
</script>
<!-- Devloped by https://pakainfo.com free download examples -->
<script type="text/x-template" id="select2-template">
  <select>
    <slot></slot>
  </select>
</script>

index.js

Vue.component('select2', {
  props: ['options', 'value'],
  template: '#select2-template',
  mounted: function () {
    var vm = this
    $(this.$el)
      .val(this.value)
      //simple vuejs init select2
      .select2({ data: this.options })
      // emit event on change simple vuejs .
      .on('change', function () {
        vm.$emit('input', this.value)
      })
  },
  watch: {
    value: function (value) {
      // update value vuejs
      $(this.$el).select2('val', value)
    },
    options: function (options) {
      // update options using vue
      $(this.$el).select2({ data: options })
    }
  },
  destroyed: function () {
    $(this.$el).off().select2('destroy')
  }
})

var vm = new Vue({
  el: '#el',
  template: '#live-template',
  data: {
    selected: 0,
    options: [
      { id: 1, text: 'Good Morning' },
      { id: 2, text: 'Welcome' }
    ]
  }
})

style.css

html, body {
  font: 14px/19px sans-serif;
}
select {
  min-width: 400px;
}

vuejs autocomplete with search box

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is Create autocomplete search with Vuejs and PHP And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.