feat: 完成 Frpilot 桌面应用核心布局与多语言支持
实现内容: - 新增多语言支持(中文/英文),包含完整翻译文件 - 适配 Windows 和 macOS 自定义标题栏,支持窗口控制与主题切换 - 新增侧边栏菜单,显示系统 CPU/内存占用与运行状态 - 配置 Tauri 窗口属性与权限,支持窗口拖拽、最大化等操作 - 新增 Pinia 状态管理,处理主题、语言与应用状态 - 新增系统统计数据获取与模拟逻辑,支持 Tauri 后端调用回退 - 新增路由配置,完成页面布局与视图组件初始化
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/** 操作系统类型 */
|
||||
export type Platform = "windows" | "macos" | "linux" | "unknown"
|
||||
|
||||
/**
|
||||
* 判断当前运行的操作系统类型。
|
||||
* 通过 navigator.userAgent 推断,避免额外引入 @tauri-apps/plugin-os。
|
||||
*/
|
||||
export function usePlatform() {
|
||||
const ua = (navigator.userAgent || "").toLowerCase()
|
||||
|
||||
const platform = computed<Platform>(() => {
|
||||
if (ua.includes("mac") || ua.includes("darwin")) return "macos"
|
||||
if (ua.includes("win")) return "windows"
|
||||
if (ua.includes("linux") || ua.includes("x11")) return "linux"
|
||||
return "unknown"
|
||||
})
|
||||
|
||||
const isMac = computed(() => platform.value === "macos")
|
||||
const isWindows = computed(() => platform.value === "windows")
|
||||
const isLinux = computed(() => platform.value === "linux")
|
||||
|
||||
return { platform, isMac, isWindows, isLinux }
|
||||
}
|
||||
Reference in New Issue
Block a user