简体   繁体   English

特定STEP角度填角的样式

[英]Style of a specific STEP angular primeng

I'm using angular with primeng and the Steps component. 我在priming和Steps组件中使用angular。 I'm trying to give an specific style to the elements of the steps that are disabled. 我正在尝试为禁用的步骤的元素提供一种特定的样式。

In the primeng documentation I saw this property badgeStyleClass but is not working for me, because the style of the disabled elements are not apply: 在primeng文档中,我看到了此属性badgeStyleClass但对我不起作用,因为禁用的元素的样式不适用:

This is my code: 这是我的代码:

this.otherItems = [
            {
                label: 'Personal',
                command: (event: any) => { }
            },
            {
                label: 'Seat',
                disabled: true,
                command: (event: any) => { }
            },
            {
                label: 'Payment',
                command: (event: any) => { }
            },
            {
                label: 'Confirmation',
                command: (event: any) => { }
            },
            {
                label: 'Order Made',
                disabled: true,
                badgeStyleClass: '#43752b',
                command: (event: any) => { }
            }
        ];

<h3>Clickable only in an specific steps</h3>
<div class="steps">
    <p-steps [model]="otherItems" [(activeIndex)]="actIndexClickableSpecificStep" [readonly]="false"></p-steps>
</div>

Thank you very much 非常感谢你

You can do it by overriding the CSS of Primeng in you app. 您可以通过在应用中覆盖Primeng的CSS来实现。 I have created an stackblitz for you. 我为您创建了一个堆叠闪电战。 I have overridden the CSS of both, disabled and active blocks. 我已经覆盖了禁用和活动块的CSS。

Here is the Stackbliz Url for your reference. 这是Stackbliz网址供您参考。

For overrding add your own class customestepper and overridden the CSS properties like below: 为了覆盖,添加您自己的类customestepper并覆盖CSS属性,如下所示:

<p-steps class="customstepper" [model]="otherItems" [(activeIndex)]="actIndexClickableSpecificStep" [readonly]="false"></p-steps>

.customstepper .ui-steps .ui-steps-item.ui-state-disabled {
  background: #ddd;
}
.customstepper .ui-steps .ui-steps-item.ui-state-disabled .ui-menuitem-link {
  color: green;
}

In this way, it only effect this particular stepper only and if you want to apply the same to other steppers, then just add this CSS to other steppers as well. 这样,它仅会影响特定的步进器,并且如果您希望将其应用于其他步进器,则只需将此CSS也添加到其他步进器即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM