-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.vue
69 lines (69 loc) · 1.54 KB
/
index.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<template>
<section id="banner" data-video="images/banner" :style="{ backgroundImage: `url(${config.bannerImg})` }">
<div class="inner">
<h1>{{ config.seo_name }}</h1>
<p>{{ inner_title }}</p>
<a @click="goToAbout" class="button scrolly gradient">了解更多</a>
</div>
<video autoplay loop muted ref="video"></video>
<div id="forFixedHeader"></div>
</section>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
computed: {
...mapGetters(['config']),
},
data() {
return {
bannerVideo: null,
}
},
props: {
inner_title: {
type: String
}
},
watch: {
'config.bannerVideo': {
handler: function (v) {
this.$nextTick(() => {
this.$refs.video.src = v;
})
},
deep: true,
},
},
activated() {
this.$nextTick(() => {
this.$refs.video.src = this.config.bannerVideo;
})
},
methods: {
to(toEl, n) {
let bridge = toEl;
let body = document.body;
let height = 0;
do {
height += bridge.offsetTop;
bridge = bridge.offsetParent;
} while (bridge !== body)
window.scrollTo({
top: height - n,
behavior: 'smooth'
})
},
goToAbout() {
this.to(document.querySelector('#two'), 0);
}
}
}
</script>
<style scoped>
#banner .inner a.gradient {
background: linear-gradient(155deg, var(--text_color) 0%, #B721FF, #3369e7, #2AF598 100%) left center/400% 400%;
color: #FFFFFF !important;
animation: move 10s infinite;
}
</style>