2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
2024-10-04 19:29:29 +00:00
|
|
|
<p>MultiSelect offers multiple slots for customization through templating.</p>
|
2023-02-28 08:29:30 +00:00
|
|
|
</DocSectionText>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center">
|
|
|
|
<MultiSelect v-model="selectedCountries" :options="countries" optionLabel="name" filter placeholder="Select Countries" display="chip" class="w-full md:w-80">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #option="slotProps">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center">
|
2023-02-28 08:29:30 +00:00
|
|
|
<img :alt="slotProps.option.name" src="https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" :class="`flag flag-${slotProps.option.code.toLowerCase()} mr-2`" style="width: 18px" />
|
|
|
|
<div>{{ slotProps.option.name }}</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2024-10-04 19:29:29 +00:00
|
|
|
<template #dropdownicon>
|
|
|
|
<i class="pi pi-map" />
|
|
|
|
</template>
|
|
|
|
<template #filtericon>
|
|
|
|
<i class="pi pi-map-marker" />
|
|
|
|
</template>
|
|
|
|
<template #header>
|
|
|
|
<div class="font-medium px-3 py-2">Available Countries</div>
|
|
|
|
</template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #footer>
|
2024-10-04 19:29:29 +00:00
|
|
|
<div class="p-3 flex justify-between">
|
|
|
|
<Button label="Add New" severity="secondary" text size="small" icon="pi pi-plus" />
|
|
|
|
<Button label="Remove All" severity="danger" text size="small" icon="pi pi-times" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</MultiSelect>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
selectedCountries: null,
|
|
|
|
countries: [
|
|
|
|
{ name: 'Australia', code: 'AU' },
|
|
|
|
{ name: 'Brazil', code: 'BR' },
|
|
|
|
{ name: 'China', code: 'CN' },
|
|
|
|
{ name: 'Egypt', code: 'EG' },
|
|
|
|
{ name: 'France', code: 'FR' },
|
|
|
|
{ name: 'Germany', code: 'DE' },
|
|
|
|
{ name: 'India', code: 'IN' },
|
|
|
|
{ name: 'Japan', code: 'JP' },
|
|
|
|
{ name: 'Spain', code: 'ES' },
|
|
|
|
{ name: 'United States', code: 'US' }
|
|
|
|
],
|
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
2024-05-20 12:14:38 +00:00
|
|
|
<MultiSelect v-model="selectedCountries" :options="countries" optionLabel="name" filter placeholder="Select Countries" display="chip" class="w-full md:w-80">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #option="slotProps">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center">
|
2023-02-28 08:29:30 +00:00
|
|
|
<img :alt="slotProps.option.name" src="https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" :class="\`flag flag-\${slotProps.option.code.toLowerCase()} mr-2\`" style="width: 18px" />
|
|
|
|
<div>{{ slotProps.option.name }}</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2024-10-04 19:29:29 +00:00
|
|
|
<template #dropdownicon>
|
|
|
|
<i class="pi pi-map" />
|
|
|
|
</template>
|
|
|
|
<template #filtericon>
|
|
|
|
<i class="pi pi-map-marker" />
|
|
|
|
</template>
|
|
|
|
<template #header>
|
|
|
|
<div class="font-medium px-3 py-2">Available Countries</div>
|
|
|
|
</template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #footer>
|
2024-10-04 19:29:29 +00:00
|
|
|
<div class="p-3 flex justify-between">
|
|
|
|
<Button label="Add New" severity="secondary" text size="small" icon="pi pi-plus" />
|
|
|
|
<Button label="Remove All" severity="danger" text size="small" icon="pi pi-times" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
2023-10-15 09:38:39 +00:00
|
|
|
</MultiSelect>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center">
|
|
|
|
<MultiSelect v-model="selectedCountries" :options="countries" optionLabel="name" filter placeholder="Select Countries" display="chip" class="w-full md:w-80">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #option="slotProps">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center">
|
2023-02-28 08:29:30 +00:00
|
|
|
<img :alt="slotProps.option.name" src="https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" :class="\`flag flag-\${slotProps.option.code.toLowerCase()} mr-2\`" style="width: 18px" />
|
|
|
|
<div>{{ slotProps.option.name }}</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2024-10-04 19:29:29 +00:00
|
|
|
<template #dropdownicon>
|
|
|
|
<i class="pi pi-map" />
|
|
|
|
</template>
|
|
|
|
<template #filtericon>
|
|
|
|
<i class="pi pi-map-marker" />
|
|
|
|
</template>
|
|
|
|
<template #header>
|
|
|
|
<div class="font-medium px-3 py-2">Available Countries</div>
|
|
|
|
</template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #footer>
|
2024-10-04 19:29:29 +00:00
|
|
|
<div class="p-3 flex justify-between">
|
|
|
|
<Button label="Add New" severity="secondary" text size="small" icon="pi pi-plus" />
|
|
|
|
<Button label="Remove All" severity="danger" text size="small" icon="pi pi-times" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</MultiSelect>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
selectedCountries: null,
|
|
|
|
countries: [
|
|
|
|
{ name: 'Australia', code: 'AU' },
|
|
|
|
{ name: 'Brazil', code: 'BR' },
|
|
|
|
{ name: 'China', code: 'CN' },
|
|
|
|
{ name: 'Egypt', code: 'EG' },
|
|
|
|
{ name: 'France', code: 'FR' },
|
|
|
|
{ name: 'Germany', code: 'DE' },
|
|
|
|
{ name: 'India', code: 'IN' },
|
|
|
|
{ name: 'Japan', code: 'JP' },
|
|
|
|
{ name: 'Spain', code: 'ES' },
|
|
|
|
{ name: 'United States', code: 'US' }
|
|
|
|
]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
composition: `
|
|
|
|
<template>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center">
|
|
|
|
<MultiSelect v-model="selectedCountries" :options="countries" optionLabel="name" filter placeholder="Select Countries" display="chip" class="w-full md:w-80">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #option="slotProps">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center">
|
2023-02-28 08:29:30 +00:00
|
|
|
<img :alt="slotProps.option.name" src="https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" :class="\`flag flag-\${slotProps.option.code.toLowerCase()} mr-2\`" style="width: 18px" />
|
|
|
|
<div>{{ slotProps.option.name }}</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2024-10-04 19:29:29 +00:00
|
|
|
<template #dropdownicon>
|
|
|
|
<i class="pi pi-map" />
|
|
|
|
</template>
|
|
|
|
<template #filtericon>
|
|
|
|
<i class="pi pi-map-marker" />
|
|
|
|
</template>
|
|
|
|
<template #header>
|
|
|
|
<div class="font-medium px-3 py-2">Available Countries</div>
|
|
|
|
</template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #footer>
|
2024-10-04 19:29:29 +00:00
|
|
|
<div class="p-3 flex justify-between">
|
|
|
|
<Button label="Add New" severity="secondary" text size="small" icon="pi pi-plus" />
|
|
|
|
<Button label="Remove All" severity="danger" text size="small" icon="pi pi-times" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</MultiSelect>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref } from "vue";
|
|
|
|
|
|
|
|
const selectedCountries = ref();
|
|
|
|
const countries = ref([
|
|
|
|
{ name: 'Australia', code: 'AU' },
|
|
|
|
{ name: 'Brazil', code: 'BR' },
|
|
|
|
{ name: 'China', code: 'CN' },
|
|
|
|
{ name: 'Egypt', code: 'EG' },
|
|
|
|
{ name: 'France', code: 'FR' },
|
|
|
|
{ name: 'Germany', code: 'DE' },
|
|
|
|
{ name: 'India', code: 'IN' },
|
|
|
|
{ name: 'Japan', code: 'JP' },
|
|
|
|
{ name: 'Spain', code: 'ES' },
|
|
|
|
{ name: 'United States', code: 'US' }
|
|
|
|
]);
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|