Files
Starlight_Lancher/tools/icon_work/fix_bc_label.py
Ap_Tx 8e9b0894ba
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
fix:一些显示bug
2026-09-13 18:25:36 +08:00

33 lines
1.0 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

p = r"D:\Project\Starlight_Lancher\apps\app-frontend\src\components\ui\Breadcrumbs.vue"
t = open(p, encoding="utf-8").read()
old = """function resolveLabel(name: string): string {
return resolveBreadcrumbLabel(
name,
(key) => breadcrumbData.getName(key),
staticLabels,
(message) => formatMessage(message),
)
}"""
new = """function resolveLabel(name: string): string {
return resolveBreadcrumbLabel(
name,
(key) => breadcrumbData.getName(key) || fallbackDynamicLabel(key),
staticLabels,
(message) => formatMessage(message),
)
}
// 动态面包屑(?Xxx在页面异步 setName 之前,回退到静态标签,避免图标与文字不同步
function fallbackDynamicLabel(key: string): string {
const fallback: Record<string, keyof typeof staticLabels> = {
BrowseTitle: 'Discover content',
}
const staticKey = fallback[key]
return staticKey ? formatMessage(staticLabels[staticKey]) : ''
}"""
assert old in t, "resolveLabel 找不到"
t = t.replace(old, new, 1)
open(p, "w", encoding="utf-8", newline="\n").write(t)
print("done")