README
The listener element drags and drops into the file and returns the file and directory tree
DEMO
Installation
yarn add drag-file-listener
Using
import Drag from 'drag-file-listener'
const drager = new DragLitener({
selector: document.querySelector('.drag'),
drop: ({ file, filesTree }) => {}
})
option
props | must | type | default | description |
---|---|---|---|---|
selector | true | element | - | listen element |
drop | true | function | - | drop event, get the file and directory tree function({ files, filesTree }){} |
- filesTree
[{
"name": "文件夹名称",
"fullPath": "路径",
"chileren": [], //子文件夹
"files": [], //当前文件夹下文件
}]
Instance Methods
- remove listener
drager.removeListener()
- add listener
drager.addListener()