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

export default {
    components: { Moveable },
    data() {
        const targetRef = null;
        const moveableRef = null;
        return { targetRef, moveableRef };
    },
    methods: {
        onClick() {
            console.log("Click");
        },
        onMouseDown() {
            console.log("MouseDown");
        },
        onDrag(e) {
            e.target.style.transform = e.transform;
        }
    },
    mounted() {
        this.targetRef = this.$refs.targetRef;
        this.moveableRef = this.$refs.moveableRef;
    }
};
</script>
<template>
    <div class="root">
        <div
            class="container"
            style="height: 100px;"
            @click="onClick"
            @mouseDown="onMouseDown"
        >
            <div
                class="target"
                ref="targetRef"
            >Target</div>
            <Moveable
                ref="moveableRef"
                :target="targetRef"
                :resizable="true"
                :preventClickDefault="true"
                :draggable="true"
                @drag="onDrag"/>
        </div>
    </div>
</template>