当interface =“popover”时无法在ion-option中更改文本颜色

问题描述 投票:3回答:1

我正在使用ion-select来选择选项,我想更改离子选项的文本颜色。我的代码如下......

<ion-item>
      <ion-select interface="popover" [(ngModel)]="selectedGrp" (ionChange)="changeGrp()">  
        <ion-option value="" selected disabled>Select</ion-option>
        <ion-option *ngFor="let item of List;let i = index" [value]="item">{{item.name}} </ion-option>
      </ion-select>
    </ion-item>

这样做没有Sass变量。我尝试过使用CSS和样式,但它不起作用。任何人都可以帮我改变离子选项的文字颜色吗?

html ionic-framework ionic2 ionic3 ion-select
1个回答
4
投票

我能够通过插入ion-options来改变文本颜色(所有app.scss

.item-radio.item ion-label {
    color: red; //your color here
}

对于选定的选项,将!important插入颜色属性

.item-radio-checked.item ion-label {
    color: blue !important; //your color here for selected option
}
© www.soinside.com 2019 - 2024. All rights reserved.