primevue-mirror/doc/galleria/ResponsiveDoc.vue

150 lines
4.8 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
2023-10-26 18:39:49 +00:00
<p>Settings per screen size is defined via the <i>responsiveOptions</i> property.</p>
2023-02-28 08:29:30 +00:00
</DocSectionText>
2024-02-21 07:31:43 +00:00
<DeferredDemo @load="loadDemoData">
<div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" 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">
2024-05-24 06:25:19 +00:00
<div class="grid grid-cols-12 gap-4 justify-center">
2024-02-21 07:31:43 +00:00
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
</div>
</template>
</Galleria>
</div>
</DeferredDemo>
2023-02-28 08:29:30 +00:00
<DocSectionCode :code="code" :service="['PhotoService']" />
</template>
<script>
import { PhotoService } from '@/service/PhotoService';
export default {
data() {
return {
images: null,
responsiveOptions: [
{
2023-10-26 18:39:49 +00:00
breakpoint: '1300px',
2023-02-28 08:29:30 +00:00
numVisible: 4
},
{
breakpoint: '575px',
numVisible: 1
}
],
code: {
2023-09-22 12:54:14 +00:00
basic: `
2023-10-23 09:26:04 +00:00
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" 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">
2024-05-24 06:25:19 +00:00
<div class="grid grid-cols-12 gap-4 justify-center">
2023-10-23 09:26:04 +00:00
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
</div>
2023-02-28 08:29:30 +00:00
</template>
2023-10-15 09:38:39 +00:00
</Galleria>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-10-23 09:26:04 +00:00
<div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" 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">
2024-05-24 06:25:19 +00:00
<div class="grid grid-cols-12 gap-4 justify-center">
2023-10-23 09:26:04 +00:00
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
</div>
2023-02-28 08:29:30 +00:00
</template>
</Galleria>
</div>
</template>
<script>
import { PhotoService } from '@/service/PhotoService';
export default {
data() {
return {
images: null,
responsiveOptions: [
{
2023-10-26 18:39:49 +00:00
breakpoint: '1300px',
2023-02-28 08:29:30 +00:00
numVisible: 4
},
{
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-23 09:26:04 +00:00
<div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" 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">
2024-05-24 06:25:19 +00:00
<div class="grid grid-cols-12 gap-4 justify-center">
2023-10-23 09:26:04 +00:00
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
</div>
2023-02-28 08:29:30 +00:00
</template>
</Galleria>
</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 responsiveOptions = ref([
{
2023-10-26 18:39:49 +00:00
breakpoint: '1300px',
2023-02-28 08:29:30 +00:00
numVisible: 4
},
{
breakpoint: '575px',
numVisible: 1
}
]);
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'
},
...
`
}
};
},
2024-02-21 07:31:43 +00:00
methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data));
}
2023-02-28 08:29:30 +00:00
}
};
</script>