index.vue
1.57 KB
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
70
71
72
<template>
<div v-loading="isLoading" class="bg" :class="{dark: styleTheme=='dark',light: styleTheme=='light'}">
<el-button v-if="styleTheme=='light'" class="theme-button dark-btn" @click="handleChangeTheme('dark')"></el-button>
<el-button v-else-if="styleTheme=='dark'" class="theme-button light-btn" @click="handleChangeTheme('light')"></el-button>
<!-- <video id="video" autoplay loop muted src="/bg.mp4"></video>-->
<app-header />
<app-main :myTheme="styleTheme" />
</div>
</template>
<script setup>
import {AppMain, AppHeader, AppBottom} from './components'
const styleTheme = ref('dark')
const isLoading = ref(false)
function handleChangeTheme(type) {
styleTheme.value = type
isLoading.value = true
setTimeout(() => {
isLoading.value = false
}, 3000)
}
</script>
<style lang="scss">
#video {
position: absolute;
z-index: -1;
width: 100%;
height: 100%;
object-fit: cover;
}
.bg {
width: 100vw;
height: 100vh;
min-width: 1000px;
overflow: hidden;
//background: rgba(0,0,0,0.75)
background-size: 100% 100%;
}
.dark {
background: url("@/assets/image/bg@2x.png") no-repeat top center;
}
.light {
background: url("@/assets/image/bg_light.png") no-repeat top center;
}
.theme-button {
position: absolute;
z-index: 2;
width: 30px;
height: 30px;
border: none;
top: 4vh;
right: 20px;
}
.dark-btn {
background: url("@/assets/image/dark@2x.png") no-repeat top center;
background-size: contain;
}
.light-btn {
background: url("@/assets/image/light@2x.png") no-repeat top center;
background-size: contain;
}
</style>