Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular Can';t删除以前隐藏的cdkDropList中的元素_Angular_Drag And Drop_Angular Cdk - Fatal编程技术网

Angular Can';t删除以前隐藏的cdkDropList中的元素

Angular Can';t删除以前隐藏的cdkDropList中的元素,angular,drag-and-drop,angular-cdk,Angular,Drag And Drop,Angular Cdk,当我开始拖动元素时,我会显示放置的目标容器,并更改原始容器的大小,使其离开放置区域 发生的情况是,正在考虑的原始容器的大小是拖动开始时的大小 当我扔掉我的元素时,他被扔进了原来的容器 <div cdkDropListGroup> <div class="list-container" [ngClass]="{ 'on-drag': dragStartEtat }" id="baseList" cdkDropList [cdkDropListData]="list1"

当我开始拖动元素时,我会显示放置的目标容器,并更改原始容器的大小,使其离开放置区域

发生的情况是,正在考虑的原始容器的大小是拖动开始时的大小

当我扔掉我的元素时,他被扔进了原来的容器

<div cdkDropListGroup>
  <div class="list-container" [ngClass]="{ 'on-drag': dragStartEtat }" id="baseList" cdkDropList
    [cdkDropListData]="list1" #baseList="cdkDropList" (cdkDropListDropped)="drop($event)">
    <div class="line" (cdkDragStarted)="dragStart($event)" (cdkDragEnded)="dragEnd($event)" cdkDrag
      *ngFor="let e of list1">{{ e }}</div>
  </div>

  <div [hidden]="!dragStartEtat" #archive="cdkDropList"  cdkDropList  class="cdk-archive"
    (cdkDropListDropped)="dropArchive($event)">
    Glissez déposez pour archiver
  </div>
</div>
如果从一开始就显示目标容器,则没有问题

预计在“归档”区域中放置时会触发dropArchive。然而,“基本列表”上的删除仍在触发中

我有没有做错什么,或者有什么解决办法来避免这种行为


下面是完整的工作示例:

预期的输出是什么?你能详细解释一下吗?嗨,马吉德!我自己也有同样的问题<代码> CDKDRAGLUD确实考虑了“代码>下拉程序< /代码>在拖动开始时的高度或位置。我试图将
cdkDrag
项拖动到树组件的子树中的
cdkDropList
中。我将鼠标悬停在导致子树崩溃的类别上(谈到DOM结构时是an
li
)。然后尝试将
cdkDrag
预览放入刚刚打开的
cdkDropList
中,会导致该项根本不会被放入droplist中。你能解决这个问题吗?就我而言,我很幸运,因为我可以使用屏幕的绝对位置,这不是最好的解决方案(如果有)。我不知道这是否有助于解决你的问题!预期产出是什么?你能详细解释一下吗?嗨,马吉德!我自己也有同样的问题<代码> CDKDRAGLUD确实考虑了“代码>下拉程序< /代码>在拖动开始时的高度或位置。我试图将
cdkDrag
项拖动到树组件的子树中的
cdkDropList
中。我将鼠标悬停在导致子树崩溃的类别上(谈到DOM结构时是an
li
)。然后尝试将
cdkDrag
预览放入刚刚打开的
cdkDropList
中,会导致该项根本不会被放入droplist中。你能解决这个问题吗?就我而言,我很幸运,因为我可以使用屏幕的绝对位置,这不是最好的解决方案(如果有)。我不知道这是否有助于解决你的问题!
.list-container {
    min-height: calc(100vh - 325px);
    max-height: calc(100vh - 325px);
    overflow: auto;
}

.dessus {
    background-color: orange;
    min-height: 300px;
    max-height: 300px;
}

.cdk-archive {
    color: white;
    transition: 0.5s;
    text-align: center;
    height: 15vh;
    background-color: rgba(74, 74, 74, 0.8);

    .cdk-drag-placeholder {
        display: none !important;
    }
}

.on-drag {
    min-height: calc(100vh - (325px + 15vh))!important;
    max-height: calc(100vh - (325px + 15vh))!important; 
    overflow: auto;  
}
drop(event) {
    console.log('drop');
}

dropArchive(event) {
    console.log('dropArchive');
}

dragStart(event: CdkDragStart) {
    this.dragStartEtat = true;
}

dragEnd(event) {
    this.dragStartEtat = false;
}