2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
|
|
|
<p>Label of an option is used as the display text of an item by default, for custom content support define an <i>option</i> template that gets the option instance as a parameter.</p>
|
|
|
|
</DocSectionText>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center">
|
2023-02-28 08:29:30 +00:00
|
|
|
<SelectButton v-model="value" :options="options" optionLabel="value" dataKey="value" aria-labelledby="custom">
|
|
|
|
<template #option="slotProps">
|
|
|
|
<i :class="slotProps.option.icon"></i>
|
|
|
|
</template>
|
|
|
|
</SelectButton>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
value: null,
|
|
|
|
options: [
|
|
|
|
{ icon: 'pi pi-align-left', value: 'Left' },
|
|
|
|
{ icon: 'pi pi-align-right', value: 'Right' },
|
|
|
|
{ icon: 'pi pi-align-center', value: 'Center' },
|
|
|
|
{ icon: 'pi pi-align-justify', value: 'Justify' }
|
|
|
|
],
|
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
|
|
|
<SelectButton v-model="value" :options="options" optionLabel="value" dataKey="value" aria-labelledby="custom">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #option="slotProps">
|
|
|
|
<i :class="slotProps.option.icon"></i>
|
|
|
|
</template>
|
2023-10-15 09:38:39 +00:00
|
|
|
</SelectButton>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center">
|
2023-02-28 08:29:30 +00:00
|
|
|
<SelectButton v-model="value" :options="options" optionLabel="value" dataKey="value" aria-labelledby="custom">
|
|
|
|
<template #option="slotProps">
|
|
|
|
<i :class="slotProps.option.icon"></i>
|
|
|
|
</template>
|
|
|
|
</SelectButton>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
value: null,
|
|
|
|
options: [
|
|
|
|
{ icon: 'pi pi-align-left', value: 'Left' },
|
|
|
|
{ icon: 'pi pi-align-right', value: 'Right' },
|
|
|
|
{ icon: 'pi pi-align-center', value: 'Center' },
|
|
|
|
{ icon: 'pi pi-align-justify', value: 'Justify' }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
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">
|
2023-02-28 08:29:30 +00:00
|
|
|
<SelectButton v-model="value" :options="options" optionLabel="value" dataKey="value" aria-labelledby="custom">
|
|
|
|
<template #option="slotProps">
|
|
|
|
<i :class="slotProps.option.icon"></i>
|
|
|
|
</template>
|
|
|
|
</SelectButton>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref } from 'vue';
|
|
|
|
|
|
|
|
const value = ref(null);
|
|
|
|
const options = ref([
|
2023-10-18 11:09:13 +00:00
|
|
|
{ icon: 'pi pi-align-left', value: 'Left' },
|
|
|
|
{ icon: 'pi pi-align-right', value: 'Right' },
|
|
|
|
{ icon: 'pi pi-align-center', value: 'Center' },
|
|
|
|
{ icon: 'pi pi-align-justify', value: 'Justify' }
|
|
|
|
]);
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|