基于WebView2实现的Win11桌面框架,利用插件自定义
chunhualin1
2026-08-12 97df0fb5ed49e37d1c8e0e62057bb72ba5c9eb6a
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
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Sample System Info</title>
  <style>
    html, body {
      margin: 0;
      width: 100%;
      height: 100%;
      background: transparent;
      color: #edf5ef;
      font-family: "Segoe UI", sans-serif;
    }
 
    body {
      box-sizing: border-box;
      padding: 18px 20px;
      background: rgba(26, 44, 38, 0.82);
      border-radius: 8px;
    }
 
    h1 {
      margin: 0 0 12px;
      font-size: 17px;
      font-weight: 650;
      letter-spacing: 0;
    }
 
    dl {
      display: grid;
      grid-template-columns: 86px 1fr;
      gap: 7px 12px;
      margin: 0;
      font-size: 13px;
    }
 
    dt {
      color: rgba(237, 245, 239, 0.68);
    }
 
    dd {
      margin: 0;
      font-variant-numeric: tabular-nums;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  </style>
</head>
<body>
  <h1>System Info</h1>
  <dl>
    <dt>Time</dt><dd id="time">--</dd>
    <dt>Viewport</dt><dd id="viewport">--</dd>
    <dt>Runtime</dt><dd id="runtime">Moli Desktop sample</dd>
  </dl>
  <script>
    const time = document.getElementById("time");
    const viewport = document.getElementById("viewport");
 
    const render = () => {
      time.textContent = new Date().toLocaleTimeString([], { hour12: false });
      viewport.textContent = `${window.innerWidth} x ${window.innerHeight}`;
    };
 
    window.addEventListener("resize", render);
    render();
    setInterval(render, 5000);
  </script>
</body>
</html>