2๐
โ
I had a similar issue with select2, and had to use paramwatchers to check when options was updated:
select: {
twoWay: true,
priority: 1000,
params: ['options'],
paramswatchers: {
"options": function (val, oldVal) {
$(this.el).select2({
data: val
})
}
}
bind: function () {
var self = this;
$(this.el).select2({
theme: "bootstrap",
closeOnSelect: true,
minimumInputLength: 3,
data: this.params.options
})
.on('change', function () {
self.set(this.value)
})
},
update: function (value) {
$(this.el).val(value).trigger('change')
},
unbind: function () {
$(this.el).off().select2('destroy')
}
}
Source: https://vuejs.org/guide/custom-directive.html#params
๐คNegorath
Source:stackexchange.com