You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PrimeNG Steps组件移动端隐藏禁用项问题求助

解决PrimeNG Steps移动端隐藏禁用项的问题

你的CSS选择器结构有误,PrimeNG中禁用的步骤项是.p-steps-item直接携带.p-disabled类,并非嵌套关系。调整SCSS代码如下:

@media screen and (max-width: 768px) {
    .custom-steps .p-steps-item.p-disabled {
        display: none;
    }
}

如果上述代码仍不生效,可能是样式优先级被组件默认样式覆盖,可以尝试提升优先级:

@media screen and (max-width: 768px) {
    :host .custom-steps .p-steps-item.p-disabled {
        display: none !important;
    }
}

另外,你的HTML代码存在标签未闭合的问题,修正为:

<p-steps [model]="steps" [readonly]="true" [activeIndex]="activeIndex" [styleClass]="'custom-steps'"></p-steps>

调整后即可在屏幕宽度≤768px时隐藏所有禁用的步骤项。

内容的提问来源于stack exchange,提问作者Antoine

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 08:04:49