update: persist store fullfiil + launchOptions validation
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
import { Plus, SettingConfig, Switch } from "@icon-park/react";
|
||||
import { Card, CardHeader, CardIcon, CardTool, CardBody } from "../window/Card";
|
||||
import { useState } from "react";
|
||||
import { ToolButton } from "../window/ToolButton";
|
||||
import useToolStore from "@/store/tool";
|
||||
|
||||
const LaunchOption = () => {
|
||||
const [LaunchOption, setLaunchOption] = useState<string>(
|
||||
"-high -refresh 120 -novid -nojoy -tickrate 128 +cl_cmdrate 128 +cl_updaterate 128 +exec auto.cfg +test"
|
||||
);
|
||||
const { launchOptions, setLaunchOption, launchIndex, setLaunchIndex } = useToolStore()
|
||||
|
||||
return (
|
||||
<Card>
|
||||
@@ -15,9 +13,9 @@ const LaunchOption = () => {
|
||||
<SettingConfig /> 启动选项
|
||||
</CardIcon>
|
||||
<CardTool>
|
||||
<ToolButton>1</ToolButton>
|
||||
<ToolButton>2</ToolButton>
|
||||
<ToolButton>3</ToolButton>
|
||||
<ToolButton onClick={() => setLaunchIndex(0)}>1</ToolButton>
|
||||
<ToolButton onClick={() => setLaunchIndex(1)}>2</ToolButton>
|
||||
<ToolButton onClick={() => setLaunchIndex(2)}>3</ToolButton>
|
||||
<ToolButton>
|
||||
<Plus />
|
||||
添加
|
||||
@@ -31,8 +29,8 @@ const LaunchOption = () => {
|
||||
<CardBody>
|
||||
<textarea
|
||||
placeholder="请输入启动选项"
|
||||
value={LaunchOption}
|
||||
onChange={(e) => setLaunchOption(e.target.value)}
|
||||
value={launchOptions[launchIndex]}
|
||||
onChange={(e) => setLaunchOption(e.target.value, launchIndex)}
|
||||
className="w-full font-mono text-base bg-transparent outline-none resize-none min-h-20"
|
||||
/>
|
||||
</CardBody>
|
||||
|
||||
Reference in New Issue
Block a user