Merge pull request #9975 from wayne-kim/patch-5
this code is not care a bubbling event
This commit is contained in:
commit
cb3c5ded0f
1 changed files with 9 additions and 11 deletions
|
@ -15,19 +15,17 @@ Example of getting a real path from a dragged-onto-the-app file:
|
|||
</div>
|
||||
|
||||
<script>
|
||||
const holder = document.getElementById('holder')
|
||||
holder.ondragover = () => {
|
||||
return false;
|
||||
}
|
||||
holder.ondragleave = holder.ondragend = () => {
|
||||
return false;
|
||||
}
|
||||
holder.ondrop = (e) => {
|
||||
e.preventDefault()
|
||||
document.addEventListener('drop', function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
for (let f of e.dataTransfer.files) {
|
||||
console.log('File(s) you dragged here: ', f.path)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
document.addEventListener('dragover', function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue