拖动

时间:2018-03-07 02:21:06

标签: html angular google-chrome safari drag-and-drop

我正在使用Angular 4,ngx-drag-drop实现拖放功能。当我在chrome上运行代码时,可拖动的项目变成静态图像(我可以从它的背景中看出来。但是在Safari中它工作正常(保留为div)。是否有任何问题?或者它&# 39; s只是ngx-drag-drop与chrome不兼容。 这就是Chrome上的样子: enter image description here

这是在Safari: enter image description here 以下是代码:

<div class="device" [dndDraggable]="draggable.data"
                 [dndEffectAllowed]="draggable.effectAllowed"
                 [dndDisableIf]="draggable.disable"
                 (dndStart)="onDragStart($event)"
                 (dndCopied)="onDraggableCopied($event)"
                 (dndLinked)="onDraggableLinked($event)"
                 (dndMoved)="onDraggableMoved($event)"
                 (dndCanceled)="onDragCanceled($event)"
                 (dndEnd)="onDragEnd($event)">
                        <div class="part1"></div>
                        <div class="part2"></div>
                        <div class="part3"></div>
                 </div>
<section class="phone" dndDropzone
                     (dndDragover)="onDragover($event)"
                     (dndDrop)="onDrop($event)"
                     >
                <div class="top">
                </div>
            </section>

在ts文件上:

export class HomePageComponent implements OnInit {

draggable = {
    // note that data is handled with JSON.stringify/JSON.parse
    // only set simple data or POJO's as methods will be lost 
    data: "myDragData",
    effectAllowed: "copyMove",
    dropEffect: "move",
    disable: false,
    handle: false
  };
...
}

0 个答案:

没有答案