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

export default {
    components: { Moveable },
    data() {
        const targetRef = null;
        return { targetRef };
    },
    methods: { onRender(e) {
        e.target.style.cssText += e.cssText;
    } },
    mounted() {
        this.targetRef = this.$refs.targetRef;
    }
};
</script>
<template>
    <div class="root">
        <div class="container">
            <div
                class="target"
                ref="targetRef"
                style="top: 50px;left: 50px;width: 200px;height: 200px;"
            >Target</div>
            <Moveable
                :target="targetRef"
                :draggable="true"
                :resizable="true"
                :rotatable="true"
                :clippable="true"
                :dragWithClip="true"
                :padding="({ left: 10, right: 10, bottom: 10, top: 10 })"
                @render="onRender"/>
        </div>
    </div>
</template>