fix:一些显示bug
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
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
This commit is contained in:
33
tools/icon_work/fix_bc_label.py
Normal file
33
tools/icon_work/fix_bc_label.py
Normal file
@ -0,0 +1,33 @@
|
||||
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")
|
||||
Reference in New Issue
Block a user