<script>
import Moveable from "vue-moveable";

export default {
    components: { Moveable },
    data() {
        const targets = ".target";
        return { targets };
    },
    methods: {
        onDragGroup({ events }) {
            events.forEach(ev => {
                ev.target.style.transform = ev.transform;
            });
        },
        onDragGroupEnd({ events }) {
            console.log(events);
        }
    },
    mounted() {
        setTimeout(() => {
            this.targets = document.querySelectorAll(".target, .moveable-area");
        }, 100);
    }
};
</script>
<template>
    <div class="container">
        <div class="target target1">Target1</div>
        <div class="target target2">Target2</div>
        <div class="target target3">Target3</div>
        <Moveable
            :target="targets"
            :draggable="true"
            @dragGroup="onDragGroup"
            @dragGroupEnd="onDragGroupEnd"/>
    </div>
</template>