add nova
This commit is contained in:
22
nova/resources/js/composables/useDragAndDrop.js
Normal file
22
nova/resources/js/composables/useDragAndDrop.js
Normal file
@@ -0,0 +1,22 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user