Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Select2 field in Laravel Vue3 metronic 8 demo 1


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


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


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.


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.


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(