Hi,
I'm trying to add a select field with the FIeld component of the vee-validate library, but it keeps displaying a simple select field.
I added these attributes on the Field component: class="form-select form-select-solid" data-control="select2" data-hide-search="true" as="select"
What I should do to init select2? What I'm missing there?
Thanks in advance,
Vahan
Hi,
Please note that the Select2 plugin requires jQuery, and combining jQuery with a Vue application is not considered good practice. Therefore, it is not included in our Metronic Vue version by default. However, you can install the jQuery and Select2 dependencies and use Select2 in Vue by following the installation instructions in the official Select2 documentation.
https://select2.org/getting-started/installation
Then you can refer to the usage examples in our documentation.
https://preview.keenthemes.com/html/metronic/docs/forms/select2
Also, as an alternative to Select2 in the Metronic Vue version, you can use the Vue-Multiselect plugin or the Element Plus select component.
Regards,
Lauris Stepanovs,
Keenthemes Support Team
Hi Lauirs,
Thank you, I checked this page and used it.
Now I have a new question: is there a ready-made select2 field that can load more on scroll?
Thank you in advance,
Vahan
Hi,
You can find an example of infinite scroll in select2 official docs.
https://select2.org/data-sources/ajax
Regards,
Lauris Stepanovs,
Keenthemes Support Team