如何为 primeng p-inputSwitch 设置 onLabel 和 offLabel
How to set onLabel and offLabel for primeng p-inputSwitch
我需要为开启状态添加“是”,为关闭状态添加“否”。是否有任何选项可用于执行此操作?
<p-inputSwitch [(ngModel)]="checked" name="first-chk" (onChange)="myFunction())"> </p-inputSwitch>
请更新样式表以显示是
.p-inputswitch.p-inputswitch-checked .p-inputswitch-slider:after {
content: "Yes" !important;
position: absolute;
top: 0 !important;
left: 0 !important;
right: 0 !important;
border: 0 !important;
height: 100%;
display: flex;
align-items: center;
font-size: 15px !important;
margin: 0px 8px !important;
color: #fff !important;
-webkit-animation: barshine 0.5s 0.1s forwards;
animation: barshine 0.5s 0.1s forwards;
}
我需要为开启状态添加“是”,为关闭状态添加“否”。是否有任何选项可用于执行此操作?
<p-inputSwitch [(ngModel)]="checked" name="first-chk" (onChange)="myFunction())"> </p-inputSwitch>
请更新样式表以显示是
.p-inputswitch.p-inputswitch-checked .p-inputswitch-slider:after {
content: "Yes" !important;
position: absolute;
top: 0 !important;
left: 0 !important;
right: 0 !important;
border: 0 !important;
height: 100%;
display: flex;
align-items: center;
font-size: 15px !important;
margin: 0px 8px !important;
color: #fff !important;
-webkit-animation: barshine 0.5s 0.1s forwards;
animation: barshine 0.5s 0.1s forwards;
}