PrimeNG BlockUI异常:block标记为true时偶尔无法遮罩组件
PrimeNG 13.4.1/Angular 13.2.1下BlockUI遮罩异常问题
环境:PrimeNG 13.4.1 + Angular 13.2.1(经历多次Angular大版本升级)
异常表现:
- 部分场景下,布尔变量
blockUpdatingPage为true时,BlockUI无法正常遮罩目标组件 - 仅偶尔能覆盖特定组件,遮罩状态与
[blocked]绑定的标记不一致 - 该问题仅在少数组件上出现
组件代码
<div> <p-blockUI [blocked]="blockUpdatingPage" [target]="blocked4" styleClass="overlayZindex"> <i class="fa fa-lock fa-4x" style="position:absolute;top:25%;left:50%"></i> </p-blockUI> <p-fieldset #blocked4 [hidden]="hideSaveAndUpdate"> <p> {{ shouldItBeBlocked() }}</p> <p-header>7. Save & Update</p-header> <div [hidden]="!createNew"> <br/> <p-progressBar mode="indeterminate" [style]="{'height': '6px'}" *ngIf="loadingBar"></p-progressBar> <span class="ui-float-label"> <input [(ngModel)]="inputText" id="float-input" maxlength="200" pInputText type="text"> <label for="float-input">Create new...</label> </span> <button (click)="checkIfBenchmarkIsSelectedCreateNew()" [disabled]="disabledFlag" align="center" label="Save & Continue" pButton style="background-color:#215A8F"></button> <br/> </div> <div [hidden]="createNew == true"> <br/> <button (click)="checkIfThingSelected(false)" [disabled]="disabledFlag || blockUpdatingPage" label="Update '{{selectedThing}}'" pButton align="center" style="background-color:#215A8F"></button> <br/> </div> </p-fieldset> </div>
状态验证函数
shouldItBeBlocked() { if (this.blockUpdatingPage === false) { return 'it should not be blocked now'; } else { return 'it should be blocked now'; } }
场景截图
- 正常遮罩:

- 未遮罩(正常状态):

- 异常状态:

排查情况
已查看BlockUI源码,按照逻辑当blocked标记为true时,组件应设置display:flex,但异常场景下组件被设为display:none,暂未定位到触发该异常的具体原因。
内容的提问来源于stack exchange,提问作者Daniel Fletemier
相关产品推荐
相关产品推荐

