Skip to content

Commit

Permalink
Merge pull request #1694 from XiaoMi/hotfix/#1693
Browse files Browse the repository at this point in the history
fix: #1693
  • Loading branch information
Flcwl authored Apr 25, 2021
2 parents dde312a + b40ba80 commit 87cce13
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- 修复 `DatePicker` type 为 daterange 时,且 showTime 为 true 选择时间显示异常 [#1640](https://github.com/XiaoMi/hiui/issues/1640)
- 修复 `Cascader` id 为 Number 类型时导致节点重复添加问题[#1648](https://github.com/XiaoMi/hiui/issues/1648)
- 修复 `Tabs` 组件 onDelete、onAdd 等方法获取数据操作异常问题[#1676](https://github.com/XiaoMi/hiui/issues/1676)
- 修复 `Upload` 在 type 为 drag 时,通过拖动文件上传,data数据不可更新[#1693](https://github.com/XiaoMi/hiui/issues/1693)
- 新增 `Table` 组件 rowExpandable 方法,对内嵌式表格中左侧箭头进行自定义[#1679](https://github.com/XiaoMi/hiui/issues/1679)

## 3.5.0
Expand Down
45 changes: 27 additions & 18 deletions components/upload/DragUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,35 @@ const DragUpload = ({
})

const [dragging, setDragging] = useState(false)
const onDragOver = useCallback((e) => {
e.preventDefault()
e.stopPropagation()
setDragging(true)
}, [])
const onDragOver = useCallback(
(e) => {
e.preventDefault()
e.stopPropagation()
setDragging(true)
},
[dragging]
)

const onDragLeave = useCallback((e) => {
e.preventDefault()
e.stopPropagation()
setDragging(false)
}, [])
const onDragLeave = useCallback(
(e) => {
e.preventDefault()
e.stopPropagation()
setDragging(false)
},
[dragging]
)

const onDrop = useCallback((e) => {
e.preventDefault()
e.stopPropagation()
if (!disabled) {
uploadFiles(e.dataTransfer.files)
}
setDragging(false)
}, [])
const onDrop = useCallback(
(e) => {
e.preventDefault()
e.stopPropagation()
if (!disabled) {
uploadFiles(e.dataTransfer.files)
}
setDragging(false)
},
[dragging, uploadFiles, data, headers, name, uploadAction]
)
const dragCls = classNames(
'hi-upload',
'hi-upload--drag',
Expand Down

0 comments on commit 87cce13

Please sign in to comment.