Select2 Custom Widget

Source code: Survey setup
Survey.defaultBootstrapCss.navigationButton = "btn btn-primary";
Survey.Survey.cssType = "bootstrap";
Survey.JsonObject.metaData.addProperty("dropdown", {name: "renderAs", default: "standard", choices: ["standard", "select2"]});
var survey = new Survey.Model({ questions: [
 { type: "dropdown", renderAs: "select2", choicesByUrl: { url: "https://restcountries.eu/rest/v1/all" }, name: "countries", title: "Please select the country you have arrived from:"}
]});


var widget = {
    name: "select2",
    isFit : function(question) { return question["renderAs"] === 'select2'; }
}

Vue.component(widget.name, {
    props: ['question', 'css', 'isEditMode'],
    template: "<select style='width: 100%;'></select>",
    mounted: function () {
        var vm = this;
        $(vm.$el).select2({
            data: vm.question.choices.map(function(choice) { return { id: choice.value, text: choice.text }; }),
            theme: "classic"
        });
        vm.question.choicesChangedCallback = function() {
            $(vm.$el).select2({data: vm.question.visibleChoices.map(function(choice) { return { id: choice.value, text: choice.text }; })});
        }
        $(vm.$el).on('select2:select', function (e) {
          vm.question.value = e.target.value;
        });
        var updateHandler = function() {
            $(vm.$el).val(vm.question.value).trigger("change");
        }
        vm.question.valueChangedCallback = updateHandler;
        updateHandler();
    },
    destroyed: function () {
        $(this.$el).select2("destroy");
    }
})
Survey.CustomWidgetCollection.Instance.addCustomWidget(widget);
survey.data = { countries: "Andorra" };

new Vue({ el: '#surveyElement', data: { survey: survey } });