我希望能够使用 CDK 拖放将来自不同容器的多个元素添加到一个容器中。是否可以从本质上对不同的项目进行颜色编码。现在,当我拖动一个项目时,它会从它放入的容器中继承样式,我希望它保持其在原始容器中的颜色。
HTML
<h2>Studio 6</h2>
<div cdkDropList #donestudio6="cdkDropList" [cdkDropListData]="studio6"
[cdkDropListConnectedTo]="[moviesList, toglist, ppolist]" class="movie-list"
(cdkDropListDropped)="onDrop($event)">
<div class="movie-block" *ngFor="let item of studio6" cdkDrag>{{item}}</div>
</div>
<div id="first" class="bottompanel">
<h2>People</h2>
<div cdkDropList #moviesList="cdkDropList" [cdkDropListData]="MoviesList"
[cdkDropListConnectedTo]="[doneMovieList, donestudio2, donestudio3, donestudio4,
donestudio5, donestudio6, donestudio7]" class="movie-list" (cdkDropListDropped)="onDrop($event)">
<div class="peopleblock" *ngFor="let moviesList of MoviesList" cdkDrag>{{moviesList}}</div>
</div>
CSS
.movie-block {
padding: 10px 5px;
border-bottom: solid 1px #ccc;
color: rgba(0, 0, 0, 0.87);
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
cursor: move;
background: white;
font-size: 12px;
}
.peopleblock {
padding: 10px 5px;
border-bottom: solid 1px #ccc;
color: rgba(0, 0, 0, 0.87);
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
cursor: move;
background: white;
font-size: 12px;
background-color: rgb(53, 201, 206);
}