2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
|
|
|
<p>Using <i>activeIndex</i>, Galleria is displayed with a specific initial image.</p>
|
|
|
|
</DocSectionText>
|
|
|
|
<div class="card flex justify-content-center">
|
|
|
|
<Galleria
|
|
|
|
v-model:activeIndex="activeIndex"
|
|
|
|
v-model:visible="displayCustom"
|
|
|
|
:value="images"
|
|
|
|
:responsiveOptions="responsiveOptions"
|
|
|
|
:numVisible="7"
|
|
|
|
containerStyle="max-width: 850px"
|
|
|
|
:circular="true"
|
|
|
|
:fullScreen="true"
|
|
|
|
:showItemNavigators="true"
|
|
|
|
:showThumbnails="false"
|
|
|
|
>
|
|
|
|
<template #item="slotProps">
|
|
|
|
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
|
|
|
|
</template>
|
|
|
|
<template #thumbnail="slotProps">
|
|
|
|
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="display: block" />
|
|
|
|
</template>
|
|
|
|
</Galleria>
|
|
|
|
|
|
|
|
<div v-if="images" class="grid" style="max-width: 400px">
|
|
|
|
<div v-for="(image, index) of images" :key="index" class="col-4">
|
|
|
|
<img :src="image.thumbnailImageSrc" :alt="image.alt" style="cursor: pointer" @click="imageClick(index)" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" :service="['PhotoService']" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { PhotoService } from '@/service/PhotoService';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
images: null,
|
|
|
|
activeIndex: 0,
|
|
|
|
responsiveOptions: [
|
|
|
|
{
|
|
|
|
breakpoint: '1024px',
|
|
|
|
numVisible: 5
|
|
|
|
},
|
|
|
|
{
|
|
|
|
breakpoint: '768px',
|
|
|
|
numVisible: 3
|
|
|
|
},
|
|
|
|
{
|
|
|
|
breakpoint: '560px',
|
|
|
|
numVisible: 1
|
|
|
|
}
|
|
|
|
],
|
|
|
|
displayCustom: false,
|
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
|
|
|
<Galleria v-model:activeIndex="activeIndex" v-model:visible="displayCustom" :value="images" :responsiveOptions="responsiveOptions" :numVisible="7"
|
2023-02-28 08:29:30 +00:00
|
|
|
containerStyle="max-width: 850px" :circular="true" :fullScreen="true" :showItemNavigators="true" :showThumbnails="false">
|
|
|
|
<template #item="slotProps">
|
|
|
|
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
|
|
|
|
</template>
|
|
|
|
<template #thumbnail="slotProps">
|
|
|
|
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="display: block" />
|
|
|
|
</template>
|
2023-10-15 09:38:39 +00:00
|
|
|
</Galleria>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<div class="card flex justify-content-center">
|
|
|
|
<Galleria v-model:activeIndex="activeIndex" v-model:visible="displayCustom" :value="images" :responsiveOptions="responsiveOptions" :numVisible="7"
|
|
|
|
containerStyle="max-width: 850px" :circular="true" :fullScreen="true" :showItemNavigators="true" :showThumbnails="false">
|
|
|
|
<template #item="slotProps">
|
|
|
|
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
|
|
|
|
</template>
|
|
|
|
<template #thumbnail="slotProps">
|
|
|
|
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="display: block" />
|
|
|
|
</template>
|
|
|
|
</Galleria>
|
|
|
|
|
|
|
|
<div v-if="images" class="grid" style="max-width: 400px">
|
|
|
|
<div v-for="(image, index) of images" :key="index" class="col-4">
|
|
|
|
<img :src="image.thumbnailImageSrc" :alt="image.alt" style="cursor: pointer" @click="imageClick(index)" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { PhotoService } from '@/service/PhotoService';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
images: null,
|
|
|
|
activeIndex: 0,
|
|
|
|
responsiveOptions: [
|
|
|
|
{
|
|
|
|
breakpoint: '1024px',
|
|
|
|
numVisible: 5
|
|
|
|
},
|
|
|
|
{
|
|
|
|
breakpoint: '768px',
|
|
|
|
numVisible: 3
|
|
|
|
},
|
|
|
|
{
|
|
|
|
breakpoint: '560px',
|
|
|
|
numVisible: 1
|
|
|
|
}
|
|
|
|
],
|
|
|
|
displayCustom: false
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
PhotoService.getImages().then((data) => (this.images = data));
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
imageClick(index) {
|
|
|
|
this.activeIndex = index;
|
|
|
|
this.displayCustom = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
composition: `
|
|
|
|
<template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<div class="card flex justify-content-center">
|
|
|
|
<Galleria v-model:activeIndex="activeIndex" v-model:visible="displayCustom" :value="images" :responsiveOptions="responsiveOptions" :numVisible="7"
|
|
|
|
containerStyle="max-width: 850px" :circular="true" :fullScreen="true" :showItemNavigators="true" :showThumbnails="false">
|
|
|
|
<template #item="slotProps">
|
|
|
|
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
|
|
|
|
</template>
|
|
|
|
<template #thumbnail="slotProps">
|
|
|
|
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="display: block" />
|
|
|
|
</template>
|
|
|
|
</Galleria>
|
|
|
|
|
|
|
|
<div v-if="images" class="grid" style="max-width: 400px">
|
|
|
|
<div v-for="(image, index) of images" :key="index" class="col-4">
|
|
|
|
<img :src="image.thumbnailImageSrc" :alt="image.alt" style="cursor: pointer" @click="imageClick(index)" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref, onMounted } from "vue";
|
|
|
|
import { PhotoService } from '@/service/PhotoService';
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
PhotoService.getImages().then((data) => (images.value = data));
|
|
|
|
});
|
|
|
|
|
|
|
|
const images = ref();
|
|
|
|
const activeIndex = ref(0);
|
|
|
|
const responsiveOptions = ref([
|
|
|
|
{
|
|
|
|
breakpoint: '1024px',
|
|
|
|
numVisible: 5
|
|
|
|
},
|
|
|
|
{
|
|
|
|
breakpoint: '768px',
|
|
|
|
numVisible: 3
|
|
|
|
},
|
|
|
|
{
|
|
|
|
breakpoint: '560px',
|
|
|
|
numVisible: 1
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
const displayCustom = ref(false);
|
|
|
|
|
|
|
|
const imageClick = (index) => {
|
|
|
|
activeIndex.value = index;
|
|
|
|
displayCustom.value = true;
|
|
|
|
};
|
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));
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
imageClick(index) {
|
|
|
|
this.activeIndex = index;
|
|
|
|
this.displayCustom = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|