fix(admin): 没有字体时不渲染「当前使用的字体」下拉

This commit is contained in:
2026-11-05 19:02:41 +08:00
parent 97b9d00cf3
commit 0aebd610fe
+21 -14
View File
@@ -2357,20 +2357,27 @@ function SystemPanel({
{font.source === 'custom' && ( {font.source === 'custom' && (
<> <>
<FormField {/* 没有字体时不渲染下拉:空列表点开只会弹出一个空白面板 */}
label="当前使用的字体" {font.items.length > 0 ? (
htmlFor="font-current" <FormField
hint={font.items.length === 0 ? '还没有字体,先在下面添加一条' : '从已保存的字体里选一个启用'} label="当前使用的字体"
> htmlFor="font-current"
<Select hint="从已保存的字体里选一个启用"
options={font.items.map((item) => ({ >
value: item.key, <Select
label: item.name === '' ? item.key : item.name, options={font.items.map((item) => ({
}))} value: item.key,
value={activeKey} label: item.name === '' ? item.key : item.name,
onChange={(current) => update({ current })} }))}
/> value={activeKey}
</FormField> onChange={(current) => update({ current })}
/>
</FormField>
) : (
<Text size="sm" tone="muted">
还没有字体,点下面的「添加字体」存一条,再回来选。
</Text>
)}
{font.items.map((item) => ( {font.items.map((item) => (
<div className="font-link" key={item.key}> <div className="font-link" key={item.key}>