rab*_*ana 6 progressive-web-apps angular
我们可以动态更改 iOS 中 PWA 应用程序的状态栏(顶部的那个)颜色吗?我正在使用 Angular 并且我一直在尝试在运行时修改apple-mobile-web-app-status-bar-style元标记,但它似乎不起作用。
this.meta.removeTag("name='apple-mobile-web-app-status-bar-style'");
if (isDarkMode) {
this.bodyElement.style.setProperty('--mainPageBackground', '#000');
this.bodyElement.style.setProperty('--mainTextColor', '#FFF');
this.meta.updateTag({ name: 'apple-mobile-web-app-status-bar-style', content: `black-translucent` }, `name='apple-mobile-web-app-status-bar-style'`);
}
else {
this.bodyElement.style.setProperty('--mainPageBackground', '#FFF');
this.bodyElement.style.setProperty('--mainTextColor', '#000');
this.meta.updateTag({ name: 'apple-mobile-web-app-status-bar-style', content: `default` }, `name='apple-mobile-web-app-status-bar-style'`);
}
Run Code Online (Sandbox Code Playgroud)
使用<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">所需的颜色并将其应用于正文,并将白色或任何背景颜色应用于页面包装。我希望它有帮助!
| 归档时间: |
|
| 查看次数: |
1550 次 |
| 最近记录: |