0

如何从垫子菜单或子菜单拖放到部分。你可以检查:Stackblitz

垫菜单的 HTML 代码:

<button mat-icon-button [matMenuTriggerFor]="menu">
    <mat-icon>add</mat-icon>
  </button>
  <mat-menu
    #menu="matMenu" cdkDropList
    [cdkDropListData]="bottomList"
    class="bottom-list"
    (cdkDropListDropped)="drop($event)"
    cdkDropListOrientation="horizontal"
  >
    <button mat-menu-item *ngFor="let item of bottomList" cdkDrag>
      {{ item.name }}
    </button>
  </mat-menu>

你能解释一下为什么我这样做,为什么我将对象与另一个我知道总是正确的对象进行比较,因为需要像布尔值或数字或字符串这样的变量?

event.previousContainer === event.container;
4

0 回答 0