Angular cdk 之 drag-drop

官網連接:https://material.angular.io/cdk/drag-drop/overviewapp

使用示例:flex

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/85063083spa

相關文章
相關標籤/搜索