Reputation: 1973
Suppose I have an input field: <input type="text" placeholder="Select Teams" />
and I should be able to select Support
by clicking the input field.
and then
I learned that this is possible using selectize. How should I be able to incorporate it as a vue directive?
Upvotes: 0
Views: 923
Reputation: 7851
Try this.
Vue.directive('selectize', function(el, binding){
var options = binding.value || {}
$(el).selectize(options)
})
Then use v-selectize
directive where you want.
You can also add more options. For example:
<input v-selectize="{maxItems: 3}" type="text" placeholder="Select Teams" />
Upvotes: 3