Skip to content

Instantly share code, notes, and snippets.

@Bouni
Created February 17, 2023 07:41
Show Gist options
  • Save Bouni/99f3745fac59230a846763b18847c45f to your computer and use it in GitHub Desktop.
Save Bouni/99f3745fac59230a846763b18847c45f to your computer and use it in GitHub Desktop.
<template>
<v-combobox v-model="country" :items="countries" item-title="name" item-value="code" label="Land" return-object>
<template v-slot:prepend-inner>
<span class="mr-2">
<country-flag :country='country.code.toLowerCase()' size='normal' v-if="country"/>
</span>
</template>
<template v-slot:item="{ item }">
<v-list-item>
<span class="mr-2">
<country-flag :country='item.value.code.toLowerCase()' size='normal'/>
</span>
<span>{{ item.title }}</span> ┆ 1 </v-list-item>
</template>
</v-combobox>
</template>
<script setup>
import { ref } from "vue";
import countries from "@/components/countries.json";
const country = ref(0);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment