官网链接:https://material.angular.io/cdk/drag-drop/overview
使用示例:
import {Component} from '@angular/core'; @Component({ selector: 'app-drag-drop-drop', template: ` <div class="dragParent" style="width: 500px; height: 500px; background-color: #f1f1f1"> <div class="example-Box" cdkDrag cdkDragRootElement=".dragParent"> 可以到处拖拽 </div> </div> `, styles: [` .example-Box { width: 100px; height: 100px; border: solid 1px #ccc; color: rgba(0, 0, 0, 0.87); cursor: move; display: flex; justify-content: center; align-items: center; text-align: center; background: #fff; border-radius: 4px; position: relative; z-index: 1; transition: Box-shadow 200ms cubic-bezier(0, 0, 0.2, 1); Box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12); } .example-Box:active { Box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12); } `] }) export class DragDropDropComponent { }
参考链接:https://blog.csdn.net/wuyuxing24/article/details/85063083
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。