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

export default {
    components: { Moveable },
    setup() {
        const moveableRef = ref(null);
        const onClick = () => {
            moveableRef.value.request("resizable", { deltaHeight: 12 }, true);
        };
        const onResize = (e) => {
            e.target.style.width = `${e.width}px`;
            e.target.style.height = `${e.height}px`;
            const input = document.querySelector(".input");
            input.innerHTML = JSON.stringify({
                dist: e.dist,
                width: e.width,
                height: e.height
            });
        };
        return { onClick, moveableRef, onResize };
    }
};
</script>
<template>
    <div class="root">
        <button @click="onClick">request</button>
        <div class="input"></div>
        <div class="container">
            <div
                class="target"
                style="width: 381.609px;height: 119.416px;color: black;margin-top: 20px;margin-left: 20px;border: none;"
            >Target1</div>
            <Moveable
                ref="moveableRef"
                :target="'.target'"
                :resizable="true"
                @resize="onResize"/>
        </div>
    </div>
</template>