|
|
@@ -1,14 +1,17 @@
|
|
1
|
1
|
<template lang="pug">
|
|
2
|
2
|
.hero.f-col(v-if="showHero")
|
|
3
|
|
- iframe(
|
|
4
|
|
- v-if="isPlaying"
|
|
5
|
|
- :src="`https://www.youtube.com/embed/${heroIdFromUrl}?autoplay=1`"
|
|
6
|
|
- frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope"
|
|
7
|
|
- allowfullscreen
|
|
8
|
|
- ).embedded
|
|
9
|
|
- .blank.f-col(v-else)
|
|
10
|
|
- h3(v-if="heroText") {{ heroText }}
|
|
11
|
|
- button(v-if="showPlaybutton" @click="isPlaying = true") play
|
|
|
3
|
+ .hero--video(v-if="heroType === 'video'")
|
|
|
4
|
+ iframe(
|
|
|
5
|
+ v-if="isPlaying"
|
|
|
6
|
+ :src="`https://www.youtube.com/embed/${heroIdFromUrl}?autoplay=1`"
|
|
|
7
|
+ frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope"
|
|
|
8
|
+ allowfullscreen
|
|
|
9
|
+ ).embedded
|
|
|
10
|
+ .blank.f-col(v-else)
|
|
|
11
|
+ h3(v-if="heroText") {{ heroText }}
|
|
|
12
|
+ button(v-if="showPlaybutton" @click="isPlaying = true") play
|
|
|
13
|
+ .hero--image(v-else)
|
|
|
14
|
+ img(:src="showHero" alt="hero image")
|
|
12
|
15
|
</template>
|
|
13
|
16
|
|
|
14
|
17
|
<script>
|
|
|
@@ -25,9 +28,11 @@ export default {
|
|
25
|
28
|
...mapState({
|
|
26
|
29
|
showHero: state => state.hero.url,
|
|
27
|
30
|
heroText: state => state.hero.text,
|
|
|
31
|
+ heroType: state => state.hero.type,
|
|
28
|
32
|
showPlaybutton: state => state.hero.playbutton,
|
|
29
|
33
|
}),
|
|
30
|
34
|
heroIdFromUrl() {
|
|
|
35
|
+ console.log()
|
|
31
|
36
|
const url = this.showHero.split('/')
|
|
32
|
37
|
return url.pop()
|
|
33
|
38
|
}
|
|
|
@@ -42,7 +47,14 @@ export default {
|
|
42
|
47
|
this.$nextTick(() => { window.addEventListener('resize', this.onResize) })
|
|
43
|
48
|
},
|
|
44
|
49
|
watch: {
|
|
|
50
|
+ $route() {
|
|
|
51
|
+ console.log('remounting hero')
|
|
|
52
|
+ console.log(this.$store)
|
|
|
53
|
+ // Clear the hero between pages
|
|
|
54
|
+ this.$store.commit('CLEAR_HERO')
|
|
|
55
|
+ },
|
|
45
|
56
|
heroHeight() {
|
|
|
57
|
+ if(!this.showHero) return
|
|
46
|
58
|
Object.assign(this.$el.style, {height: this.heroHeight + 'px'})
|
|
47
|
59
|
}
|
|
48
|
60
|
},
|