<script>
import Moveable from "vue3-moveable";
import { ref } from "vue";

export default {
    components: { Moveable },
    setup() {
        const moveableRef = ref(null);
        const onClick = () => {
            moveableRef.value.request("draggable", {
                isInstant: true,
                deltaX: 0,
                deltaY: 0
            });
        };
        const onRender = e => {
            e.target.style.cssText += e.cssText;
        };
        return { onClick, moveableRef, onRender };
    }
};
</script>
<template>
    <div class="container">
        <button @click="onClick">Request</button>
        <div class="target">Target</div>
        <Moveable
            ref="moveableRef"
            :target="'.target'"
            :draggable="true"
            :rotatable="true"
            :resizable="true"
            :snappable="true"
            :bounds="({ left: 200, top: 0 })"
            @render="onRender"/>
    </div>
</template>