Skip to content

Commit

Permalink
fix: 输入设置失效
Browse files Browse the repository at this point in the history
  • Loading branch information
maotoumao committed Nov 3, 2024
1 parent f1d2a95 commit 8134643
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export default function InputSettingItem<T extends keyof IAppConfig>(
trim
} = props;

const [tmpValue, setTmpValue] = useState<string | null>(null);
const value = useAppConfig(keyPath);
const [tmpValue, setTmpValue] = useState<string | null>(value as string || "");

return (
<div
Expand Down Expand Up @@ -57,13 +57,14 @@ export default function InputSettingItem<T extends keyof IAppConfig>(
}

if (!event.defaultPrevented) {
console.log(tmpValue);
AppConfig.setConfig({
[keyPath]: trim ? tmpValue.trim() as any : tmpValue as any
});
}
setTmpValue(null);
}}
value={(tmpValue || value || "") as string}
defaultValue={value as string}
value={(tmpValue || "") as string}
></input>
</div>
);
Expand Down

0 comments on commit 8134643

Please sign in to comment.