我正在寻找一种解决方案或解决方法来禁用可拖动组件的子级的 ngDraggable 指令。
我有一个聊天窗口,并且希望它只能在其标题上拖动,而不是在聊天的其余部分中拖动。
<div class="position-absolute shadow-sm d-flex flex-column chat-window"
style="z-index: 999; width:500px; height: 400px;"
[inBounds]="inBounds"
ngDraggable
ngResizable
[rzMinWidth]="300"
[rzMinHeight]="250"
[position]="position">
<app-chat-tab-desktop-header [chatTab]="chatTab"></app-chat-tab-desktop-header>
<app-chat-tab class="d-flex flex-grow-1" (click)="$event.stopPropagation();$event.preventDefault()" [chatTab]="chatTab"></app-chat-tab>
</div>
我尝试使用 (click)="$event.stopPropagation();$event.preventDefault()"
但没有效果。
有什么想法吗?
最佳答案
尝试使用 (mousedown)
事件。它应该可以工作。
关于javascript - 为 child 停用 angular2-draggable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58784201/