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

如何移除Primeng Vertical Stepper中的垂直分隔线?

移除PrimeNG垂直步进器的步骤间竖线

完全可以用::ng-deep来实现这个需求,PrimeNG垂直步进器的步骤间竖线是通过内部CSS伪元素控制的,你只需要覆盖对应的样式即可。

在你的组件样式文件里添加以下代码:

::ng-deep .p-stepper-vertical .p-stepper-step:not(:last-child):after {
  display: none;
}

如果上面的样式优先级不够,可以加上你组件的类名来提升优先级,比如你的组件类是my-stepper-component,代码改成:

::ng-deep my-stepper-component .p-stepper-vertical .p-stepper-step:not(:last-child):after {
  display: none;
}

这段代码的作用是选中垂直模式下步进器中,除最后一个步骤外的所有步骤的after伪元素(也就是用来显示竖线的元素),通过display: none把它隐藏掉,这样就能移除所有步骤间的竖线了。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.18 14:22:01