【发布时间】:2018-08-06 03:13:19
【问题描述】:
我意识到一个即时通讯工具。用户可以同时显示两个聊天窗口。我希望第一个窗口显示为蓝色,第二个显示为灰色。
这是我所拥有的:
<div class="chat-window-container" style="z-index: 1040">
<window-item
*ngFor="let thread of (windows ? windows.slice(0,2):[])"
[thread]="thread">
</window-item>
</div>
我希望两个上的一个窗口项目是蓝色的,另一个是灰色的。
//////更新//////
这是我的 window-container.html :
<div class="chat-window-container" style="z-index: 1040">
<window-item
*ngFor="let thread of windows; let i = index"
[class.myColorClass1]="i % 2 == 0" [class.myColorClass2]="i % 2 != 0"
[thread]="thread">
</window-item>
</div>
这是我的 window-container.scss:
.myColorClass1 {
color: blue;
}
.myColorClass2 {
color: grey;
}
它适用于所有其他窗口,但我还有另一个问题。我的窗口容器文件不会改变我的 div 的好部分。我要编辑的 div 在另一个组件中:window-item。
<div class="panel-heading top-bar">
可以在window-container组件的.scss filer中更改window-item组件的div的样式吗?
【问题讨论】: