Skip to content

Commit

Permalink
fix: output input value sync
Browse files Browse the repository at this point in the history
  • Loading branch information
QC2168 committed May 30, 2023
1 parent acb56d7 commit 10e3704
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/pages/home/hooks/useEditOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ export default function useEditOutput() {
const [isEditOutput, setIsEditOutput] = useState(false);
const [tempOutput, setTempOutput] = useState('');
const [outputPath, setOutputPath] = useState('');
const [i, u] = useMib();
const [, u] = useMib();
const { createSuccessMessage, createErrorMessage } = useMessage();
const tempOutputChange = (event:any) => {
setTempOutput(event.target!.value!);
};
const showEditOutputInput = () => {
setIsEditOutput(true);
setOutputPath(outputPath);
};
const saveOutput = async () => {
try {
Expand All @@ -33,6 +32,7 @@ export default function useEditOutput() {
});
return {
outputPath,
tempOutput,
isEditOutput,
showEditOutputInput,
saveOutput,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default function Analysis() {
{
isEditOutput ? (
<Space.Compact>
<Input allowClear onChange={(e) => tempOutputChange(e)} defaultValue={mibInstance?.config.output} />
<Input allowClear onChange={(e) => tempOutputChange(e)} defaultValue={outputPath} />
<Button onClick={() => saveOutput()} type="primary">确定</Button>
</Space.Compact>
) : (
Expand Down

0 comments on commit 10e3704

Please sign in to comment.