data mopved into asyncData() method

This commit is contained in:
ManjaroOne666 2019-02-04 11:53:23 +00:00
parent 17b65dedb0
commit 37eb527ecb
2 changed files with 46 additions and 32 deletions

View File

@ -69,7 +69,7 @@
<BackgroundImageLoader slot="background" <BackgroundImageLoader slot="background"
class="background" class="background"
image-url="https://via.placeholder.com/1920x1080" :image-url="imageUrl"
> >
<div slot="overlay" class="background-tint background-overlay"></div> <div slot="overlay" class="background-tint background-overlay"></div>
</BackgroundImageLoader> </BackgroundImageLoader>
@ -156,6 +156,12 @@ export default {
}, 1000) }, 1000)
}, },
}, },
asyncData () {
return new Promise ((resolve, reject) => {
resolve({ imageUrl: "https://via.placeholder.com/1920x1080" })
})
},
} }
</script> </script>

View File

@ -9,7 +9,7 @@
</BackgroundImagePreloader> </BackgroundImagePreloader>
<BackgroundImageLoader v-else slot="background" <BackgroundImageLoader v-else slot="background"
class="background" class="background"
image-url="https://via.placeholder.com/1920x1080" :image-url="imageUrl"
> >
<div slot="overlay" class="background-tint background preloader-overlay"></div> <div slot="overlay" class="background-tint background preloader-overlay"></div>
</BackgroundImageLoader> </BackgroundImageLoader>
@ -55,6 +55,37 @@ export default {
return { return {
showPreloaderBackground: false, showPreloaderBackground: false,
activeIndex: 0, activeIndex: 0,
}
},
head () {
return {
title: 'My Services',
// TODO meta - hid, name, content
}
},
computed: {
backgroundImageUrls () {
return this.services.map(el => el.backgroundImageUrl)
},
},
mounted () {
const mq = window.matchMedia("(min-width: 40em)")
this.showPreloaderBackground = mq.matches
},
methods: {
handleMouseOver(index) {
this.activeIndex = index
},
},
asyncData () {
return new Promise((resolve, reject) => {
resolve({
imageUrl: "https://via.placeholder.com/1920x1080",
services: [ services: [
{ {
'heading': 'Portraits', 'heading': 'Portraits',
@ -85,31 +116,8 @@ export default {
'linkUrl': 'galleries?gallery=3', 'linkUrl': 'galleries?gallery=3',
}, },
] ]
} })
}, })
head () {
return {
title: 'My Services',
// TODO meta - hid, name, content
}
},
computed: {
backgroundImageUrls () {
return this.services.map(el => el.backgroundImageUrl)
},
},
mounted () {
const mq = window.matchMedia("(min-width: 40em)")
this.showPreloaderBackground = mq.matches
},
methods: {
handleMouseOver(index) {
this.activeIndex = index
},
}, },
} }
</script> </script>