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