是否可以将角CDKDROPLIST连接到CDKDRAGBOUNDARY?
我目前正在使用Angular CDK Drow功能,我想将元素从CDKDROPLIST移动到CDKDRAGBOUNDARY,因此我需要将它们连接起来。为了更好地解释这一点,想象一下Div侧面的拖放列表,我希望列表中的元素成为DIV中的免费拖放元素,但是这似乎不适用于CDKDROPLIST和CDKDRAGBOUNDARY,并且不适用于我测试过的两个CDKDROPLIST。如果有人知道如何处理,请告诉我,即使它是解决方案,而没有下降列表或下降界限。
<div cdkDropList
#mapList="cdkDropList"
[cdkDropListConnectedTo]="[labelsList]"
class="map-container">
<div id="map"></div>
</div>
<div class="answers-container">
<div class="answers-title"><span>Labels</span></div>
<div cdkDropList
#labelsList="cdkDropList"
[cdkDropListConnectedTo]="[mapList]"
class="answers-labels">
<div cdkDrag
cdkDragBoundary=".map-container"
id="answer.id" class="answers-labels-box"
[ngStyle]="{'background-color':answer.color }"
*ngFor="let answer of answers">
<span cdkDragHandle class="grab"><i class="pi pi-times"></i></span>
{{answer.text}}
</div>
</div>
</div>
I am currently using the angular CDK drag and drop feature and I want to move elements from a CdkDropList to a CdkDragBoundary, therefore I need to connect them. To explain this better, imagine a drag and drop list on the side of a div, I want the elements from the list to become free draggable elements in the div, however this seems to not work with cdkDropList and cdkDragBoundary and it does not work with two cdkDropLists either from what I've tested. Please if anyone has any idea how this can be handled let me know, even if it is a solution without drop lists or drop boundaries.
<div cdkDropList
#mapList="cdkDropList"
[cdkDropListConnectedTo]="[labelsList]"
class="map-container">
<div id="map"></div>
</div>
<div class="answers-container">
<div class="answers-title"><span>Labels</span></div>
<div cdkDropList
#labelsList="cdkDropList"
[cdkDropListConnectedTo]="[mapList]"
class="answers-labels">
<div cdkDrag
cdkDragBoundary=".map-container"
id="answer.id" class="answers-labels-box"
[ngStyle]="{'background-color':answer.color }"
*ngFor="let answer of answers">
<span cdkDragHandle class="grab"><i class="pi pi-times"></i></span>
{{answer.text}}
</div>
</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我了解您的问题,但是要限制列表中的CDKDRAG您会做的:
I am not sure I understand your issue, but to limit the cdkDrag within a list you would do: