要想修改顶部背景颜色,需要用到这个属性:content就是你要设置的颜色
-
- <meta name="theme-color" content="#f8f8f8" />
然后再加上下面的设置:
-
- <meta name="apple-mobile-web-app-capable" content="yes" />
-
-
- <meta name="apple-mobile-web-app-status-bar-style" content="default" />
- <meta name="application-name" content="web独立页面的名称" />
总的设置:
- html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-
- <meta name="apple-mobile-web-app-capable" content="yes" />
-
-
- <meta name="apple-mobile-web-app-status-bar-style" content="default" />
- <meta name="application-name" content="web独立页面的名称" />
-
- <link rel="apple-touch-icon-precomposed" sizes="120x120" href="icon.png" />
-
- <meta name="theme-color" content="#fc5531" />
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
- <title>收入明细title>
- head>
- <body>
- <div id="app">div>
- <script type="module" src="/src/main.ts">script>
- body>
- html>
如果没有设置状态栏背景颜色,可能看到的效果:背景是黑色或者白色
配置好状态栏颜色后: