feat: OCR识别支持拖拽导入
This commit is contained in:
14
app/page.jsx
14
app/page.jsx
@@ -984,9 +984,8 @@ export default function HomePage() {
|
||||
if (fileInputRef.current) fileInputRef.current.value = '';
|
||||
};
|
||||
|
||||
const handleFilesUpload = async (event) => {
|
||||
const files = Array.from(event.target.files || []);
|
||||
if (!files.length) return;
|
||||
const processFiles = async (files) => {
|
||||
if (!files?.length) return;
|
||||
|
||||
setIsScanning(true);
|
||||
setScanModalOpen(false); // 关闭选择弹窗
|
||||
@@ -1129,6 +1128,14 @@ export default function HomePage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleFilesUpload = (event) => {
|
||||
processFiles(Array.from(event.target.files || []));
|
||||
};
|
||||
|
||||
const handleFilesDrop = (files) => {
|
||||
processFiles(files);
|
||||
};
|
||||
|
||||
const toggleScannedCode = (code) => {
|
||||
setSelectedScannedCodes(prev => {
|
||||
const next = new Set(prev);
|
||||
@@ -4089,6 +4096,7 @@ export default function HomePage() {
|
||||
<ScanPickModal
|
||||
onClose={() => setScanModalOpen(false)}
|
||||
onPick={handleScanPick}
|
||||
onFilesDrop={handleFilesDrop}
|
||||
isScanning={isScanning}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user