2023-02-28 08:29:30 +00:00
< template >
< DocSectionText v-bind ="$attrs" >
2024-10-04 19:29:29 +00:00
< p > Select 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" >
< Select v-model ="selectedCountry" :options="countries" optionLabel="name" placeholder="Select a Country" class="w-full md:w-56" >
2023-02-28 08:29:30 +00:00
< template # value = "slotProps" >
2024-05-20 12:14:38 +00:00
< div v-if ="slotProps.value" class="flex items-center" >
2023-02-28 08:29:30 +00:00
< img :alt ="slotProps.value.label" src = "https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" : class = "`mr-2 flag flag-${slotProps.value.code.toLowerCase()}`" style = "width: 18px" / >
< div > { { slotProps . value . name } } < / div >
< / div >
< span v-else >
{ { slotProps . placeholder } }
< / span >
< / template >
< 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.label" src = "https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" : class = "`mr-2 flag flag-${slotProps.option.code.toLowerCase()}`" 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 # header >
< div class = "font-medium p-3" > Available Countries < / div >
< / template >
< template # footer >
< div class = "p-3" >
< Button label = "Add New" fluid severity = "secondary" text size = "small" icon = "pi pi-plus" / >
< / div >
< / template >
2024-04-18 14:22:30 +00:00
< / Select >
2023-02-28 08:29:30 +00:00
< / div >
< DocSectionCode :code ="code" / >
< / template >
< script >
export default {
data ( ) {
return {
selectedCountry : 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
< Select v-model ="selectedCountry" :options="countries" optionLabel="name" placeholder="Select a Country" class="w-full md:w-56" >
2023-02-28 08:29:30 +00:00
< template # value = "slotProps" >
2024-05-20 12:14:38 +00:00
< div v-if ="slotProps.value" class="flex items-center" >
2023-02-28 08:29:30 +00:00
< img :alt ="slotProps.value.label" src = "https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" : class = "\`mr-2 flag flag-\${slotProps.value.code.toLowerCase()}\`" style = "width: 18px" / >
< div > { { slotProps . value . name } } < / div >
< / div >
< span v-else >
{ { slotProps . placeholder } }
< / span >
< / template >
< 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.label" src = "https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" : class = "\`mr-2 flag flag-\${slotProps.option.code.toLowerCase()}\`" 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 # header >
< div class = "font-medium p-3" > Available Countries < / div >
< / template >
< template # footer >
< div class = "p-3" >
< Button label = "Add New" fluid severity = "secondary" text size = "small" icon = "pi pi-plus" / >
< / div >
< / template >
2024-04-18 14:22:30 +00:00
< / Select >
2023-10-15 09:38:39 +00:00
` ,
2023-09-22 12:54:14 +00:00
options : `
< template >
2024-05-20 12:14:38 +00:00
< div class = "card flex justify-center" >
< Select v-model ="selectedCountry" :options="countries" optionLabel="name" placeholder="Select a Country" class="w-full md:w-56" >
2023-02-28 08:29:30 +00:00
< template # value = "slotProps" >
2024-05-20 12:14:38 +00:00
< div v-if ="slotProps.value" class="flex items-center" >
2023-02-28 08:29:30 +00:00
< img :alt ="slotProps.value.label" src = "https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" : class = "\`mr-2 flag flag-\${slotProps.value.code.toLowerCase()}\`" style = "width: 18px" / >
< div > { { slotProps . value . name } } < / div >
< / div >
< span v-else >
{ { slotProps . placeholder } }
< / span >
< / template >
< 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.label" src = "https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" : class = "\`mr-2 flag flag-\${slotProps.option.code.toLowerCase()}\`" 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 # header >
< div class = "font-medium p-3" > Available Countries < / div >
< / template >
< template # footer >
< div class = "p-3" >
< Button label = "Add New" fluid severity = "secondary" text size = "small" icon = "pi pi-plus" / >
< / div >
< / template >
2024-04-18 14:22:30 +00:00
< / Select >
2023-02-28 08:29:30 +00:00
< / div >
< / template >
< script >
export default {
data ( ) {
return {
selectedCountry : 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" >
< Select v-model ="selectedCountry" :options="countries" optionLabel="name" placeholder="Select a Country" class="w-full md:w-56" >
2023-02-28 08:29:30 +00:00
< template # value = "slotProps" >
2024-05-20 12:14:38 +00:00
< div v-if ="slotProps.value" class="flex items-center" >
2023-02-28 08:29:30 +00:00
< img :alt ="slotProps.value.label" src = "https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" : class = "\`mr-2 flag flag-\${slotProps.value.code.toLowerCase()}\`" style = "width: 18px" / >
< div > { { slotProps . value . name } } < / div >
< / div >
< span v-else >
{ { slotProps . placeholder } }
< / span >
< / template >
< 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.label" src = "https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png" : class = "\`mr-2 flag flag-\${slotProps.option.code.toLowerCase()}\`" 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 # header >
< div class = "font-medium p-3" > Available Countries < / div >
< / template >
< template # footer >
< div class = "p-3" >
< Button label = "Add New" fluid severity = "secondary" text size = "small" icon = "pi pi-plus" / >
< / div >
< / template >
2024-04-18 14:22:30 +00:00
< / Select >
2023-02-28 08:29:30 +00:00
< / div >
< / template >
< script setup >
import { ref } from "vue" ;
const selectedCountry = 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 >