From 211524258a5d9cb90ccb85a90d668a0bbcc4c077 Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Mon, 21 Jan 2019 10:56:12 +0000 Subject: [PATCH] refactored background image loading into separate component --- components/BackgroundImageLoader.vue | 52 ++++++++++++++++++++++++++-- components/ContentPage.vue | 48 +++---------------------- pages/index.vue | 5 ++- 3 files changed, 57 insertions(+), 48 deletions(-) diff --git a/components/BackgroundImageLoader.vue b/components/BackgroundImageLoader.vue index 22f8674..b55d59e 100644 --- a/components/BackgroundImageLoader.vue +++ b/components/BackgroundImageLoader.vue @@ -1,5 +1,11 @@ @@ -8,7 +14,22 @@ import imageLoader from '~/mixins/imageLoader.js' export default { mixins: [ imageLoader ], + props: { + bgLoading: { + type: String, + required: false, + default: function () { + return 'linear-gradient(310deg, #35405d, #6174aa, #a8b3d0, #e2e5ef)' + } + }, + img: { + type: String, + required: false, + default: function () { + return 'url(https://via.placeholder.com/1920x1080)' + } + }, }, data () { @@ -16,6 +37,19 @@ export default { } }, + computed: { + loadingStyle () { + return { + background: this.bgLoading + } + }, + backgroundStyle () { + return { + backgroundImage: this.img + } + } + }, + methods: { } } @@ -23,11 +57,23 @@ export default { diff --git a/components/ContentPage.vue b/components/ContentPage.vue index 44e83bf..ec31f8c 100644 --- a/components/ContentPage.vue +++ b/components/ContentPage.vue @@ -2,16 +2,12 @@

{{ heading }}

-
+
- -
-
-
+
+
@@ -19,20 +15,6 @@