fix: 桌面导出改用 IPC 直写(另存为对话框),设置页显示版本号

This commit is contained in:
root
2026-10-16 13:07:38 +08:00
parent 599aa09ab8
commit f0d30e2c29
11 changed files with 66 additions and 33 deletions
+7
View File
@@ -3,6 +3,13 @@ import { Capacitor } from '@capacitor/core'
// 导出文本文件:返回落盘位置(原生平台返回文件 URI;浏览器返回空串)
// 原生环境写入公共文档目录,失败时回退应用缓存目录
export async function downloadText(filename: string, text: string): Promise<string> {
// 桌面版(Electron):经主进程直接写盘,弹标准另存为对话框
const w = window as unknown as { electronAPI?: { saveFile: (n: string, c: string) => Promise<{ saved: boolean; path: string }> } }
if (w.electronAPI && w.electronAPI.saveFile) {
const r = await w.electronAPI.saveFile(filename, text)
return r && r.saved ? r.path : ''
}
if (Capacitor.isNativePlatform()) {
const { Filesystem, Directory, Encoding } = await import('@capacitor/filesystem')
try {