-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
109 lines (95 loc) · 2.69 KB
/
index.html
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>金芭蕾</title>
<style>
* {
margin: 0;
padding: 0;
text-decoration: none;
}
.container {
display: flex;
flex-wrap: wrap;
justify-content: center;
column-gap: 30px;
row-gap: 30px;
}
.movie {
background-color: #f4f4f4;
box-shadow: 0 0 10px #f4f4f4;
width: 300px;
height: 200px;
position: relative;
border-radius: 10px;
}
.title-wrapper {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
.title {
margin-top: 40px;
height: 200px;
line-height: 40px;
text-align: center;
font-size: 20px;
color: #fff;
}
.text {
height: 40px;
backdrop-filter: blur(10px);
}
.title-wrapper img {
display: block;
height: 80px;
width: 80px;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="container" id="app">
<div class="movie" v-for="movie in movies" :style="{'background-color': movie.bgColor}">
<div class="title-wrapper">
<a :href="movie.href">
<div class="title">
<div class="text">{{movie.title}}</div>
<img src="./play.png">
</div>
</a>
</div>
<!-- <video :src=" movie.href" class="video" width="400" height="300"></video> -->
</div>
</div>
</body>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script type="module">
import data from './data.js'
function getRandomIntInclusive(min, max) {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled); // 包含最小值和最大值
}
const { createApp } = Vue
const randomColor = () => {
return `rgb(${getRandomIntInclusive(0, 255)}, ${getRandomIntInclusive(0, 255)}, ${getRandomIntInclusive(0, 255)})`
}
createApp({
data() {
const movies = data.map(d => {
d.bgColor = randomColor()
return d
})
return {
movies
}
}
}).mount('#app')
</script>
</html>