angular - PrimeNg- 侧边栏模块未正确显示
问题描述
我正在尝试创建一个右侧边栏 1 导航(单击时打开btn1
),并且在其中应该从顶部打开另一个边栏导航(单击时打开btn2
),其中边栏 2 应该在覆盖之外,只要它打开。(覆盖是每个侧边栏都不正确)。
我正在使用这个primeng链接- https://www.primefaces.org/primeng/#/sidebar
https://stackblitz.com/edit/primeng-template-4gf9tj?file=app%2Fapp.component.html
注意:-当侧边栏1打开时,黑色背景会覆盖全屏,同样当侧边栏2从顶部打开时,侧边栏1上应该有黑色背景。
解决方案
根据 primefaces文档。
baseZIndex -number - 0- 在分层中使用的基本 zIndex 值。
您需要应用z-index
到-1
图层,它似乎在它的顶部。
像这样
<button (click)="openTab()">btn1</button>
<p-sidebar class="menuPanel" [(visible)]="opened" position="right" [showCloseIcon]="true" autoZIndex="true" baseZIndex="-1">
Sidebar1
<button (click)="openTab2()">btn2</button>
<p-sidebar class="menuPanel" [(visible)]="filterStatus" position="top" [showCloseIcon]="true" autoZIndex="false" baseZIndex="-1">
sidebar2
</p-sidebar>
</p-sidebar>
编辑:
所以,这似乎不是primeng的问题
我相信你忘了包括主题风格
我添加了
<link rel="stylesheet" type="text/css" href="/node_modules/primeicons/primeicons.css" />
<link rel="stylesheet" type="text/css" href="/node_modules/primeng/resources/themes/nova-light/theme.css" />
<link rel="stylesheet" type="text/css" href="/node_modules/primeng/resources/primeng.min.css" />
按照此处所述
现在效果很好
这是改变的东西
<button (click)="openTab()">btn1</button>
<p-sidebar class="menuPanel" [(visible)]="opened" position="right" [showCloseIcon]="true" autoZIndex="true" baseZIndex="99999">
Sidebar1
<button (click)="openTab2()">btn2</button>
<p-sidebar class="menuPanel" [(visible)]="filterStatus" position="top" [showCloseIcon]="true" autoZIndex="false" baseZIndex="9999999">
sidebar2
</p-sidebar>
</p-sidebar>
推荐阅读
- javascript - 简单 chrome 扩展上的 javascript 意外标识符
- javascript - Google 表格应用程序脚本 - 警报未按顺序执行
- eager-loading - Laravel 5.7 - 如何访问嵌套 API 资源中的数据透视表?
- python - 如何从下划线分隔的名称中获取第一个单词和后续单词?
- css - 纯CSS可以实现这种布局吗?
- python-3.x - 为什么我在 python 中使用 while lopp 在每个步骤中添加 0.050 时得到 x=0.15000000000000002
- c# - Newtonsoft 异常抛出,“输入字符串 '08' 不是有效数字”
- html - 按钮不响应 css 中的字体系列声明
- c# - 在循环期间使编辑器响应
- ruby-on-rails - 如何通过在 Ruby/Rails 中编辑数据库中的所有文章来修复我的编辑表单?