primevue-mirror/pages/galleria/AutoPlay.vue

112 lines
3.4 KiB
Vue
Raw Normal View History

2022-09-09 20:41:18 +00:00
<template>
<div>
<div class="content-section introduction">
<div class="feature-intro">
<h1>Galleria <span>AutoPlay</span></h1>
<p>AutoPlay mode is used to implement slideshows.</p>
</div>
</div>
<div class="content-section implementation">
<div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" containerStyle="max-width: 640px" :circular="true" :autoPlay="true" :transitionInterval="2000">
<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>
</div>
<div class="content-section documentation">
2022-09-12 13:27:56 +00:00
<ClientOnly>
2022-09-14 14:26:41 +00:00
<TabView>
<TabPanel header="Source">
<pre v-code><code><template v-pre>
2022-09-09 20:41:18 +00:00
&lt;Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" containerStyle="max-width: 640px"
:circular="true" :autoPlay="true" :transitionInterval="2000"&gt;
&lt;template #item="slotProps"&gt;
&lt;img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block;" /&gt;
&lt;/template&gt;
&lt;template #thumbnail="slotProps"&gt;
&lt;img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="display: block;" /&gt;
&lt;/template&gt;
&lt;/Galleria&gt;
</template>
</code></pre>
2022-09-14 14:26:41 +00:00
<pre v-code.script><code>
2022-09-09 20:41:18 +00:00
import PhotoService from '../../service/PhotoService';
export default {
data() {
return {
images: null,
responsiveOptions: [
{
breakpoint: '1024px',
numVisible: 5
},
{
breakpoint: '768px',
numVisible: 3
},
{
breakpoint: '560px',
numVisible: 1
}
]
}
},
galleriaService: null,
created() {
this.galleriaService = new PhotoService();
},
mounted() {
this.galleriaService.getImages().then(data => this.images = data);
}
}
</code></pre>
2022-09-14 14:26:41 +00:00
</TabPanel>
</TabView>
</ClientOnly>
2022-09-09 20:41:18 +00:00
</div>
</div>
</template>
<script>
import PhotoService from '../../service/PhotoService';
export default {
data() {
return {
images: null,
responsiveOptions: [
{
breakpoint: '1024px',
numVisible: 5
},
{
breakpoint: '768px',
numVisible: 3
},
{
breakpoint: '560px',
numVisible: 1
}
]
};
},
galleriaService: null,
created() {
this.galleriaService = new PhotoService();
},
mounted() {
this.galleriaService.getImages().then((data) => (this.images = data));
}
};
</script>