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

export default {
    components: { Moveable },
    data() {
        const moveableRef = null;
        return { moveableRef };
    },
    methods: {
        onClick() {
            this.$refs.moveableRef.request("draggable", {
                isInstant: true,
                deltaX: 0,
                deltaY: 0
            });
        },
        onRender(e) {
            e.target.style.cssText += e.cssText;
        }
    },
    mounted() {
        this.moveableRef = this.$refs.moveableRef;
    }
};
</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>