primevue-mirror/doc/galleria/ThumbnailDoc.vue

239 lines
7.7 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Thumbnails represent a smaller version of the actual content.</p>
</DocSectionText>
2023-10-04 09:32:01 +00:00
<div class="card">
2023-02-28 08:29:30 +00:00
<div class="flex flex-wrap gap-3 mb-5 align-self-center">
<div class="flex flex-wrap gap-3 mb-5">
<div v-for="option in positionOptions" :key="option.label" class="flex align-items-center">
<RadioButton v-model="position" :inputId="option.label" name="option" :value="option.value" />
<label :for="option.label" class="ml-2"> {{ option.label }} </label>
</div>
</div>
</div>
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="4" :thumbnailsPosition="position" containerStyle="max-width: 640px">
<template #item="slotProps">
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
</template>
<template #thumbnail="slotProps">
<div class="grid grid-nogutter justify-content-center">
2023-08-09 07:10:38 +00:00
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
2023-02-28 08:29:30 +00:00
</div>
</template>
</Galleria>
</div>
<DocSectionCode :code="code" :service="['PhotoService']" />
</template>
<script>
import { PhotoService } from '@/service/PhotoService';
export default {
data() {
return {
images: null,
position: 'bottom',
positionOptions: [
{
label: 'Bottom',
value: 'bottom'
},
{
label: 'Top',
value: 'top'
},
{
label: 'Left',
value: 'left'
},
{
label: 'Right',
value: 'right'
}
],
responsiveOptions: [
{
breakpoint: '991px',
numVisible: 4
},
{
breakpoint: '767px',
numVisible: 3
},
{
breakpoint: '575px',
numVisible: 1
}
],
code: {
2023-09-22 12:54:14 +00:00
basic: `
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="4" :thumbnailsPosition="position" containerStyle="max-width: 640px">
2023-02-28 08:29:30 +00:00
<template #item="slotProps">
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
</template>
<template #thumbnail="slotProps">
<div class="grid grid-nogutter justify-content-center">
2023-08-09 04:47:11 +00:00
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block;" />
2023-02-28 08:29:30 +00:00
</div>
</template>
2023-10-15 09:38:39 +00:00
</Galleria>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-10-04 09:32:01 +00:00
<div class="card">
2023-02-28 08:29:30 +00:00
<div class="flex flex-wrap gap-3 mb-5 align-self-center">
<div class="flex flex-wrap gap-3 mb-5">
<div v-for="option in positionOptions" :key="option.label" class="flex align-items-center">
<RadioButton v-model="position" :inputId="option.label" name="option" :value="option.value" />
<label :for="option.label" class="ml-2"> {{ option.label }} </label>
</div>
</div>
</div>
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="4" :thumbnailsPosition="position" containerStyle="max-width: 640px">
<template #item="slotProps">
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
</template>
<template #thumbnail="slotProps">
<div class="grid grid-nogutter justify-content-center">
2023-08-09 04:47:11 +00:00
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block;" />
2023-02-28 08:29:30 +00:00
</div>
</template>
</Galleria>
</div>
</template>
<script>
import { PhotoService } from '@/service/PhotoService';
export default {
data() {
return {
images: null,
position: 'bottom',
positionOptions: [
{
label: 'Bottom',
value: 'bottom'
},
{
label: 'Top',
value: 'top'
},
{
label: 'Left',
value: 'left'
},
{
label: 'Right',
value: 'right'
}
],
responsiveOptions: [
{
breakpoint: '991px',
numVisible: 4
},
{
breakpoint: '767px',
numVisible: 3
},
{
breakpoint: '575px',
numVisible: 1
}
]
};
},
mounted() {
PhotoService.getImages().then((data) => (this.images = data));
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-10-04 09:32:01 +00:00
<div class="card">
2023-02-28 08:29:30 +00:00
<div class="flex flex-wrap gap-3 mb-5 align-self-center">
<div class="flex flex-wrap gap-3 mb-5">
<div v-for="option in positionOptions" :key="option.label" class="flex align-items-center">
<RadioButton v-model="position" :inputId="option.label" name="option" :value="option.value" />
<label :for="option.label" class="ml-2"> {{ option.label }} </label>
</div>
</div>
</div>
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="4" :thumbnailsPosition="position" containerStyle="max-width: 640px">
<template #item="slotProps">
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
</template>
<template #thumbnail="slotProps">
<div class="grid grid-nogutter justify-content-center">
2023-08-09 04:47:11 +00:00
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block;" />
2023-02-28 08:29:30 +00:00
</div>
</template>
</Galleria>
</div>
</template>
<script setup>
import { ref, onMounted } from "vue";
import { PhotoService } from '@/service/PhotoService';
const images = ref();
const position = ref('bottom');
const positionOptions = ref([
{
label: 'Bottom',
value: 'bottom'
},
{
label: 'Top',
value: 'top'
},
{
label: 'Left',
value: 'left'
},
{
label: 'Right',
value: 'right'
}
]);
const responsiveOptions = ref([
{
breakpoint: '991px',
numVisible: 4
},
{
breakpoint: '767px',
numVisible: 3
},
{
breakpoint: '575px',
numVisible: 1
}
]);
onMounted(() => {
PhotoService.getImages().then((data) => (images.value = data));
});
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-02-28 08:29:30 +00:00
data: `
/* PhotoService */
{
itemImageSrc: 'https://primefaces.org/cdn/primevue/images/galleria/galleria1.jpg',
thumbnailImageSrc: 'https://primefaces.org/cdn/primevue/images/galleria/galleria1s.jpg',
alt: 'Description for Image 1',
title: 'Title 1'
},
...
`
}
};
},
mounted() {
PhotoService.getImages().then((data) => (this.images = data));
}
};
</script>