UNPKG

dm-vue3-ui

Version:

This Components Library will help get you started developing in Vue 3.

28 lines (27 loc) 533 B
import { ref, reactive } from "vue"; const useDraggable = (width) => { const activeDraggable = ref(false); const draggableStyle = reactive({ minWidth: width, width }); const resizingHandle = (e, maxWidth) => { if (e.w >= maxWidth) { Object.assign(draggableStyle, { width: maxWidth }); } else { Object.assign(draggableStyle, { width: e.w }); } }; return { activeDraggable, draggableStyle, resizingHandle }; }; export { useDraggable as default };