Files
online.tbbank.gov.tm-larave…/nova/resources/js/composables/useDragAndDrop.js
2024-09-01 18:54:23 +05:00

23 lines
467 B
JavaScript

import { ref } from 'vue'
export function useDragAndDrop(emit) {
const startedDrag = ref(false)
const files = ref([])
const handleOnDragEnter = () => (startedDrag.value = true)
const handleOnDragLeave = () => (startedDrag.value = false)
const handleOnDrop = e => {
files.value = e.dataTransfer.files
emit('fileChanged', e.dataTransfer.files)
}
return {
startedDrag,
handleOnDragEnter,
handleOnDragLeave,
handleOnDrop,
}
}