处理文件粘贴上传的时候, 粘贴了一个文件, 结果事件打印出来除了文件, 还有个 string,
onPaste: (event) ->
clipboardData = event.clipboardData
acceptedFiles = @props.acceptedFiles.split(',')
.map (extension) -> extension.slice(1)
Array::forEach.call clipboardData.types, (type, i) =>
console.log type, i, clipboardData.items[i]
if type is 'Files'
matchFile = acceptedFiles.some (extension) ->
fileType = clipboardData.items[i].type
fileType.indexOf(extension) >= 0
if matchFile
file = clipboardData.items[i].getAsFile()
console.log 'file found', file
return
console.log 'not found'

这个行为有点奇怪, 有遇到过的同学吗?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
光阴似箭催人老,日月如移越少年。