我正在尝试执行kendo ui multiselect,类似于下面的代码。但是我需要将所选项目的背景颜色从红色更改为其他颜色。我尝试在popupsettings中提供自定义CSS,但仍然无法正常工作。 大多数谷歌的答案都在jQuery中,但我需要它在角度4中。请你帮帮我
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<p>Custom values are <strong>enabled</strong>. Type a custom value.</p>
<p>primitive data</p>
<div class="example-wrapper">
<kendo-multiselect
[data]="sizes"
[value]="selectedSizes"
[allowCustom]="true"
(valueChange)="onSizeChange($event)"
>
<ng-template kendoMultiSelectCustomItemTemplate let-customText>
<strong>{{ customText }}</strong>
</ng-template>
</kendo-multiselect>
</div>
`
})
export class AppComponent {
public sizes: Array<string> = [ "Small", "Medium", "Large" ];
public selectedSizes: Array<string> = [];
public onSizeChange(value) {
this.selectedSizes = value;
}
}
答案 0 :(得分:0)
将以下CSS添加到您的组件中:
/deep/ .k-item.k-state-selected {
background-color: green !important;
}
答案 1 :(得分:0)
这是剑道解决方案。
:host ::ng-deep .k-state-selected {
background-color: green !important;
}
url:https://www.progress.com/blogs/options-for-styling-components-in-kendo-ui-builder