fix(config): selected option

This commit is contained in:
kunish 2024-10-13 14:16:21 +08:00
parent fc96dc995a
commit d6ce1376a6
No known key found for this signature in database
GPG Key ID: 67D3ACD788F3A7CD

View File

@ -260,13 +260,16 @@ const ConfigForm: ParentComponent<{
<Select
id="mode"
value={configsData()?.mode}
onChange={(e) =>
void updateBackendConfigAPI('mode', e.target.value, refetch)
}
>
<For each={modes()}>
{(name) => <option value={name}>{t(name as keyof Dict)}</option>}
{(name) => (
<option selected={name === configsData()?.mode} value={name}>
{t(name as keyof Dict)}
</option>
)}
</For>
</Select>
</div>
@ -311,7 +314,6 @@ const ConfigForm: ParentComponent<{
<Select
id="tun-ip-stack"
value={configsData()?.tun?.stack}
onChange={(e) =>
void updateBackendConfigAPI(
'tun',
@ -320,10 +322,16 @@ const ConfigForm: ParentComponent<{
)
}
>
<option>Mixed</option>
<option>gVisor</option>
<option>System</option>
<option>LWIP</option>
<For each={['Mixed', 'gVisor', 'System', 'LWIP']}>
{(name) => (
<option
selected={configsData()?.tun?.stack === name}
value={name}
>
{name}
</option>
)}
</For>
</Select>
</div>