2019-01-02 21:11:40 +00:00
|
|
|
<template>
|
2019-01-03 14:06:28 +00:00
|
|
|
<ContentPage heading="The Index Page Heading">
|
2019-01-22 12:52:10 +00:00
|
|
|
<BackgroundImageLoader slot="background"
|
|
|
|
:image-url="currentImageUrl"
|
|
|
|
@imageLoaded="handleImageLoaded"
|
|
|
|
@imageLoadError="handleImageLoadError"
|
|
|
|
/>
|
2019-01-03 14:06:28 +00:00
|
|
|
</ContentPage>
|
2019-01-02 21:11:40 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-01-03 14:06:28 +00:00
|
|
|
import ContentPage from '@/components/ContentPage'
|
2019-01-21 10:56:12 +00:00
|
|
|
import BackgroundImageLoader from '@/components/BackgroundImageLoader'
|
2019-01-03 14:06:28 +00:00
|
|
|
|
2019-01-02 21:11:40 +00:00
|
|
|
export default {
|
|
|
|
name: 'HomePage',
|
2019-01-03 14:06:28 +00:00
|
|
|
|
|
|
|
components: {
|
2019-01-21 10:56:12 +00:00
|
|
|
ContentPage,
|
|
|
|
BackgroundImageLoader
|
2019-01-03 14:06:28 +00:00
|
|
|
},
|
|
|
|
|
2019-01-02 21:11:40 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2019-01-22 12:52:10 +00:00
|
|
|
currentImageIndex: -1,
|
|
|
|
bgImages: [
|
|
|
|
'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider.jpg',
|
|
|
|
'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider-2.jpeg',
|
|
|
|
'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider-3.jpeg',
|
|
|
|
'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/4-edit-3.jpg',
|
|
|
|
'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/4-edit.jpg',
|
|
|
|
'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/image-1.png',
|
|
|
|
'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider-4.jpeg',
|
|
|
|
],
|
2019-01-02 21:11:40 +00:00
|
|
|
}
|
2019-01-22 12:52:10 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
currentImageUrl () {
|
|
|
|
let url = null
|
|
|
|
if (this.currentImageIndex > -1) {
|
|
|
|
url = this.bgImages[this.currentImageIndex]
|
|
|
|
}
|
|
|
|
return url
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted () {
|
|
|
|
if (this.bgImages.length > 1) {
|
|
|
|
this.setNextIndex()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
setNextIndex () {
|
|
|
|
this.currentImageIndex =
|
|
|
|
this.currentImageIndex < this.bgImages.length - 1 ? this.currentImageIndex + 1 : 0
|
|
|
|
},
|
|
|
|
|
|
|
|
handleImageLoaded () {
|
|
|
|
window.setTimeout(() => {
|
|
|
|
this.setNextIndex()
|
|
|
|
}, 3000)
|
|
|
|
},
|
|
|
|
|
|
|
|
handleImageLoadError () {
|
|
|
|
this.setNextIndex()
|
|
|
|
},
|
2019-01-02 21:11:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
</style>
|