fix(新建选图): 修复原生选图取消状态
build.yaml / build (push) Successful in 45s

This commit is contained in:
xiaoqidun committed 2026-10-31 13:55:52 +08:00
1 parent 63849508d3
commit 6a30e0d840
1 file changed
+5 -2
+5 -2
View File
@@ -824,11 +824,14 @@ class NativeHost {
event.preventDefault();
try {
const files = (await this.call("open", {multiple:input.multiple, directory:input.webkitdirectory, accept:input.accept})).map(value => new NativeFile(value));
if (!files.length) return;
if (!files.length) { input.dispatchEvent(new Event("cancel", {bubbles:true})); return; }
setInputFiles(input, files);
input.dispatchEvent(new Event("input", {bubbles:true}));
input.dispatchEvent(new Event("change", {bubbles:true}));
} catch (error) { if (error.name !== "AbortError") onError(error); }
} catch (error) {
if (error.name === "AbortError") input.dispatchEvent(new Event("cancel", {bubbles:true}));
else onError(error);
}
}, true);
}