Fetch select options on click

Learn how to fetch options only when the select it first activated.

We can use @open event to load options the first time the select options are opened:

vue
<SelectElement
  name="countries"
  :native="false"
  :resolve-on-load="false"
  items="/countries"
  @open="(el$) => {
    if (el$.input.extendedOptions.length) {
      return
    }
    
    el$.updateItems()
  }"
/>

We can do the same for MultiselectElement and TagsElement.

  
👋 Hire Vueform team for form customizations and developmentLearn more