ios PWA 中的黑色半透明不起作用
Posted
技术标签:
【中文标题】ios PWA 中的黑色半透明不起作用【英文标题】:Black-Translucent in ios PWA does not work 【发布时间】:2021-06-11 20:52:13 【问题描述】:我用 Flutter Web 制作了一个 Pwa,并在整个项目中设置了颜色:#8C3144。在 Index.html 上,我有黑色半透明,所以 ios 中的状态栏也变成了 #8C3144,但它继续保持黑色。我不明白我需要更改什么,我 不要认为问题出在 Flutter 项目中
<!DOCTYPE html>
<html>
<head>
<base href="/">
<meta charset="UTF-8">
<meta name="theme-color" content="#8C3144">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="follow crash">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="crash">
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>
<title>Crash</title>
<link rel="manifest" href="manifest.json">
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-core.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-auth.js"></script>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig =
apiKey: "xxxxxxxxxxxxxxxxxxx",
authDomain: "xxxxxxxxxxxxxxxxxxxxxx",
databaseURL: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
projectId: "xxxxxxxxxxxxxxxxxxxxxx",
storageBucket: "xxxxxxxxxxxxxxxxxxx",
messagingSenderId: "xxxxxxxxxxxxxxxxxxxx",
appId: "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
measurementId: "xxxxxxxxxxxxx"
;
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
<script>
if ('serviceWorker' in navigator)
window.addEventListener('flutter-first-frame', function ()
navigator.serviceWorker.register('flutter_service_worker.js');
);
</script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>
【问题讨论】:
【参考方案1】:已解决
在 index.html 的头部添加这个:
<style>
body
background-color: #79d279;
</style>
【讨论】:
以上是关于ios PWA 中的黑色半透明不起作用的主要内容,如果未能解决你的问题,请参考以下文章
React Native:iOS 中的透明堆栈导航器不起作用
iOS 7 导航栏背景模糊效果在 iPhone 4 中不起作用