Skip to content

Instantly share code, notes, and snippets.

@cn-2k
Last active November 25, 2021 14:31
Show Gist options
  • Save cn-2k/4c1e895d32a2f5f991dfec28a739d211 to your computer and use it in GitHub Desktop.
Save cn-2k/4c1e895d32a2f5f991dfec28a739d211 to your computer and use it in GitHub Desktop.
@vueform/multiselect - state/city
<p class="mb-1 text-brand-mainDark">
Select state | {{selectedState}}
</p>
<Multiselect
placeholder="Select state"
:minChars="1"
:required="true"
autocomplete="undefined"
v-model="selectedState"
name="states"
label="name"
value-prop="id"
:options="states"
:searchable="true"
:track-by="'name'"
noOptionsText="List empty!"
noResultsText="No results found!"
@select="getCities"
@clear="clearCities"
/>
<p class="mt-4 mb-1 text-brand-mainDark">
Select city {{selectedCity}}
</p>
<Multiselect
placeholder="Select city"
:minChars="1"
:required="true"
autocomplete="undefined"
v-model="selectedCity"
name="cities"
label="name"
value-prop="id"
:options="cities"
:searchable="true"
:track-by="'name'"
noOptionsText="List empty!"
noResultsText="No results found!"
:disabled="!selectedState"
/>
// v-model = is a reactive prop
// options = is a array
// value-prop and track-by = is options of filtering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment