Vuejs Input multiple Tags with dynamic autocomplete using Tag Manager

Vuejs Input multiple Tags with dynamic autocomplete using Tag Manager

In this Post We Will Explain About is Vuejs Input multiple Tags with dynamic autocomplete using Tag Manager With Example and Demo.

Welcome on infinityknow.com – Examples ,The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Vuejs – Input multiple tags with dynamic autocomplete example

In this post we will show you Best way to implement Bootstrap – Input multiple tags example using Tag Manager Vuejs, hear for How to Dynamic Autocomplete Tag Input Plugin For Vuejs with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Include External libs

First of all the include all the Tag-manager using all the external libs add and css with js included.

READ :  Free POS Software Canada point of sale systems

selectize.bootstrap3.min.css
bootstrap.min.css
bootstrap.min.js
selectize.js
vue.js 

index.html

and then second one created one or more div and give the uniq id and call the vuejs int method and one or more function call to this tag input select box.

<div id="parm"></div>

<script type="text/x-template" id="live-template">
  <div>
              
   <button v-on:click="tag_add" class="btn btn-sm">add option</button>
   <button v-on:click="live_text_change" class="btn btn-sm">program</button>
  
    <p>Selected: {{ choosed_cat }}</p>
    <selectize v-bind:options="options" v-model="choosed_cat" multiple size="1"
         data-dropdown-parent="body" data-max-options="100"
         data-value-field= 'id' data-label-field= 'text' data-search-field= 'text' data-sort-field= 'text'>
    </selectize>
  <br/>
  basic:
    <selectize data-placeholder="program" data-dropdown-parent="body" data-max-items="2">
						<option value="">Select a Languages...</option>
						<option value="4">Laravel</option>
						<option value="1">PHP</option>
						<option value="3">PHP jQuery</option>
						<option value="5">Angularjs Vuejs</option>
				</selectize>
  <br/>
  <p>Selected: {{ choosed_cat }}</p>
    <selectize v-bind:options="options" v-model="choosed_cat" multiple size="1"
         data-dropdown-parent="body" data-max-options="100"
         data-value-field= 'id' data-label-field= 'text' data-search-field= 'text' data-sort-field= 'text'>
    </selectize>
  <br/>
  basic:
    <selectize data-placeholder="program" data-dropdown-parent="body" data-max-items="2">
						<option value="">Select a Languages...</option>
						<option value="4">Thomas Edison</option>
						<option value="1">PHP</option>
						<option value="3">PHP jQuery</option>
						<option value="5">Angularjs Vuejs</option>
				</selectize>
  <br/>
  <p>Selected: {{ choosed_cat }}</p>
    <selectize v-bind:options="options" v-model="choosed_cat" multiple size="1"
         data-dropdown-parent="body" data-max-options="100"
         data-value-field= 'id' data-label-field= 'text' data-search-field= 'text' data-sort-field= 'text'>
    </selectize>
  <br/>
  basic:
    <selectize data-placeholder="program" data-dropdown-parent="body" data-max-items="2">
						<option value="">Select a Languages...</option>
						<option value="4">Laravel Install</option>
						<option value="1">PHP</option>
						<option value="3">PHP jQuery</option>
						<option value="5">Angularjs Vuejs</option>
				</selectize>
  <br/>
</div>

</script>
gfdgf

index.js

Vue.component('selectize', {
  props: ['options', 'value'],
  template: '<select><slot></slot></select>',
  mounted: function () {
    var vm = this;
    var opt = $.extend({},$(this.$parm).data());
    if (this.options != null)
    	opt.options = this.options;
    this.sel = $(this.$parm).selectize(opt)
    	.on("change",function(){
          vm.$emit('input', vm.sel.getValue());
        })[0].selectize;
    this.sel.setValue(this.value,true);
  },
  watch: {
    value: function (value) {
    	this.sel.setValue(value,true);
    },
    options: function (options) {
    		var val = this.sel.getValue();
        this.sel.clearOptions();
        this.sel.tag_add(options);
        this.sel.refreshOptions(false);
        this.sel.setValue(val);
    }
  },
  destroyed: function () {
  	this.sel.destroy();
  }
})

var vm = new Vue({
  parm: '#parm',
  template: '#live-template',
      methods:{
      tag_add:function(){
				this.options.push({id:this.live-pro,text:"opt " + this.live-pro});
        this.live-pro++;
      },
      live_text_change : function(){
      	this.choosed_cat=[4];
      }
    },
  data: {
    choosed_cat: [3],
    live-pro: 8,
    maxOptionText : "program",
    options: [
       { "id": 1, "text": "Angularjs" }, { "id": 2, "text": "Vuejs" }, { "id": 3, "text": "Codignter" }, { "id": 4, "text": "Yii" }, { "id": 5, "text": "Mysqli" }, { "id": 6, "text": "Mysql" }, { "id": 7, "text": "Magento" }, { "id": 8, "text": "Asp.net" }
    ]
  }
})

Example

READ :  Best Online Masters Degrees in Norway

I hope you have Got Vuejs Input multiple Tags with dynamic autocomplete using Tag Manager And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.

Add a Comment

Your email address will not be published. Required fields are marked *