基于WebView2实现的Win11桌面框架,利用插件自定义
Moli
2026-08-12 e2d07826ede5c1df0f884ef8a59e0a89c95b7d08
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
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Sample Clock</title>
  <style>
    html, body {
      margin: 0;
      width: 100%;
      height: 100%;
      background: transparent;
      color: #f7fbff;
      font-family: "Segoe UI", sans-serif;
    }
 
    body {
      display: grid;
      place-items: center;
      background: rgba(18, 24, 32, 0.76);
      border-radius: 8px;
    }
 
    .time {
      font-size: 34px;
      font-weight: 650;
      letter-spacing: 0;
    }
 
    .date {
      margin-top: 4px;
      color: rgba(247, 251, 255, 0.72);
      font-size: 13px;
      text-align: center;
    }
  </style>
</head>
<body>
  <main>
    <div class="time" id="time">--:--:--</div>
    <div class="date" id="date"></div>
  </main>
  <script>
    const time = document.getElementById("time");
    const date = document.getElementById("date");
    const render = () => {
      const now = new Date();
      time.textContent = now.toLocaleTimeString([], { hour12: false });
      date.textContent = now.toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" });
    };
    render();
    setInterval(render, 1000);
  </script>
</body>
</html>