Sunday, March 11, 2018

Using select2 with vuejs directive, data from html - development

Using select2 with vuejs directive, data from html

I have tried to create a vuejs2 directive, which would pick the already rendered select and wrap it into select2. This part is working but doesn’t pick the selected value:

Vue.directive('select', {
    inserted: function (el) {

        $(el).select2({
            matcher: modelMatcher,
            minimumResultsForSearch: 6,
            dropdownAutoWidth: true,
            width: 'auto'
        });

    }
});

Any ideas how to do this? This probably worked with vuejs 1:

https://gist.github.com/themsaid/c0548e19f247b832ac4f

but not working any more.



from Laravel Questions and Answers https://laravelquestions.com/laravel/using-select2-with-vuejs-directive-data-from-html/
via Lzo Media

No comments:

Post a Comment