1
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { onMounted, onUnmounted, ref } from "vue";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { fetchSoftwareInfo } from "../api/oemSoftwareInfo.js";
|
||||
import { applyWindowBranding } from "../services/windowBranding.js";
|
||||
|
||||
const software = ref({
|
||||
softwareName: "",
|
||||
@@ -55,6 +56,7 @@ onMounted(async () => {
|
||||
loading.value = true;
|
||||
software.value = await fetchSoftwareInfo();
|
||||
loading.value = false;
|
||||
await applyWindowBranding(software.value);
|
||||
|
||||
await syncMaximizedState();
|
||||
if (isTauri()) {
|
||||
|
||||
14
src/services/windowBranding.js
Normal file
14
src/services/windowBranding.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const DEFAULT_TITLE = "aiclient";
|
||||
|
||||
function isTauri() {
|
||||
return typeof window !== "undefined" && "__TAURI_INTERNALS__" in window;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步浏览器标签标题(任务栏标题/图标由 Rust get_software_info 设置)。
|
||||
* @param {{ softwareName?: string }} branding
|
||||
*/
|
||||
export async function applyWindowBranding({ softwareName } = {}) {
|
||||
if (!isTauri()) return;
|
||||
document.title = String(softwareName ?? "").trim() || DEFAULT_TITLE;
|
||||
}
|
||||
Reference in New Issue
Block a user