Skip to content

Commit f9246b6

Browse files
committed
update
1 parent 8f349e5 commit f9246b6

File tree

1 file changed

+6
-5
lines changed
  • geojson-editor/src/components/features

1 file changed

+6
-5
lines changed

geojson-editor/src/components/features/IO.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,21 @@ async function handleDownload() {
9191
})),
9292
};
9393
94+
let writable: FileSystemWritableFileStream | undefined;
9495
try {
9596
const handle: FileSystemFileHandle = await (window as any).showSaveFilePicker(opts); // 打开保存文件对话框
96-
const writable: FileSystemWritableFileStream = await handle.createWritable(); // 创建可写入的文件对象
97+
writable = await handle.createWritable(); // 创建可写入的文件对象
9798
9899
const extension = handle.name.split('.').pop()!;
99-
let encode = file_process.find(x => x.extension === `.${extension}`)!.encode;
100+
let encode = file_process.find(x => x.extension === `.${extension}`)?.encode;
100101
if (!encode) encode = file_process.find(x => x.extension === '.geojson')!.encode!;
101102
102-
writable.write(encode(geojson)).then(()=>{
103-
writable.close();
103+
writable.write(encode(geojson)).then(() => {
104+
writable?.close();
104105
});
105106
106107
} catch (e) {
107-
108+
writable?.close();
108109
}
109110
}
110111
else {

0 commit comments

Comments
 (0)