-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
38 lines (35 loc) · 965 Bytes
/
index.html
File metadata and controls
38 lines (35 loc) · 965 Bytes
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
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 先引入日间主题 -->
<link rel="stylesheet" href="./src/styles/vars.css">
<link href="https://unpkg.com/@wangeditor/editor@latest/dist/css/style.css" rel="stylesheet">
<!-- 再引入夜晚主题 -->
<link rel="stylesheet" href="./src/styles/darkVars.css">
<title>Vite App</title>
</head>
<style>
#app {
height: 100vh;
width: 100vw;
}
</style>
<body>
<button onclick="toggleTheme()">切换主题</button>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
<script>
function toggleTheme() {
const html = document.documentElement;
if (html.getAttribute('data-theme') === 'dark') {
html.removeAttribute('data-theme');
} else {
html.setAttribute('data-theme', 'dark');
}
}
</script>
</html>