From 243f90ac9b922183325dda0aa8b0c7df63fb8353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=B8=80=E4=B9=8B?= Date: Sat, 3 Jun 2023 19:18:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8DFormItem?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=AF=BC=E8=87=B4=E7=9A=84=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E3=80=81=E5=82=A8=E5=AD=98=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=AD=89=E5=8A=9F=E8=83=BD=E6=97=A0=E6=B3=95=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 16 ++++++++-------- package.json | 2 +- .../components/CloudScriptPlan/index.tsx | 19 +++++++++---------- src/pages/components/ScriptStorage/index.tsx | 3 ++- .../components/UserConfigPanel/index.tsx | 3 ++- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 95176439..e0be51a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "scriptcat", - "version": "0.13.0-beta", + "version": "0.13.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "scriptcat", - "version": "0.13.0-beta", + "version": "0.13.2", "license": "GPLv3", "dependencies": { "@arco-design/web-react": "^2.47.0", @@ -176,9 +176,9 @@ } }, "node_modules/@arco-design/web-react": { - "version": "2.47.1", - "resolved": "https://registry.npmjs.org/@arco-design/web-react/-/web-react-2.47.1.tgz", - "integrity": "sha512-fVjW59iN3aP48yiJchqGOnCh8bEmoOtoC40S/gdfzmwK7Ef3vh5GPRUydscLhReePck2vi6JLyV0aXEZRKkorA==", + "version": "2.49.0", + "resolved": "https://registry.npmjs.org/@arco-design/web-react/-/web-react-2.49.0.tgz", + "integrity": "sha512-g+B8d8am2inpMd3zGoWZ8TNDBDFZO2AiTzZurN+2q69bzpbsbiX41BG8ujV4GQPJSAt/GVGini0Hv8+LzQdmtw==", "dependencies": { "@arco-design/color": "^0.4.0", "@babel/runtime": "^7.5.5", @@ -17561,9 +17561,9 @@ } }, "@arco-design/web-react": { - "version": "2.47.1", - "resolved": "https://registry.npmjs.org/@arco-design/web-react/-/web-react-2.47.1.tgz", - "integrity": "sha512-fVjW59iN3aP48yiJchqGOnCh8bEmoOtoC40S/gdfzmwK7Ef3vh5GPRUydscLhReePck2vi6JLyV0aXEZRKkorA==", + "version": "2.49.0", + "resolved": "https://registry.npmjs.org/@arco-design/web-react/-/web-react-2.49.0.tgz", + "integrity": "sha512-g+B8d8am2inpMd3zGoWZ8TNDBDFZO2AiTzZurN+2q69bzpbsbiX41BG8ujV4GQPJSAt/GVGini0Hv8+LzQdmtw==", "requires": { "@arco-design/color": "^0.4.0", "@babel/runtime": "^7.5.5", diff --git a/package.json b/package.json index 56e390c5..bca8df74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scriptcat", - "version": "0.13.1", + "version": "0.13.2", "description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!", "author": "CodFrm", "license": "GPLv3", diff --git a/src/pages/components/CloudScriptPlan/index.tsx b/src/pages/components/CloudScriptPlan/index.tsx index 6d167360..88ca96b1 100644 --- a/src/pages/components/CloudScriptPlan/index.tsx +++ b/src/pages/components/CloudScriptPlan/index.tsx @@ -4,13 +4,11 @@ import { Button, Checkbox, Form, - FormInstance, Input, Message, Modal, Select, } from "@arco-design/web-react"; -import FormItem from "@arco-design/web-react/es/Form/form-item"; import { IconQuestionCircleFill } from "@arco-design/web-react/icon"; import { ExportParams, @@ -19,7 +17,9 @@ import { } from "@Pkg/cloudscript/cloudscript"; import CloudScriptFactory from "@Pkg/cloudscript/factory"; import JSZip from "jszip"; -import React, { useEffect, useRef } from "react"; +import React, { useEffect } from "react"; + +const FormItem = Form.Item; const cloudScriptParams = CloudScriptFactory.params(); @@ -43,7 +43,7 @@ const CloudScriptPlan: React.FC<{ script?: Script; onClose: () => void; }> = ({ script, onClose }) => { - const formRef = useRef(null); + const [form] = Form.useForm(); const [visible, setVisible] = React.useState(false); const [cloudScriptType, setCloudScriptType] = React.useState("local"); @@ -59,10 +59,10 @@ const CloudScriptPlan: React.FC<{ setModel(data); if (data && data.params[data.target]) { setCloudScriptType(data.target); - formRef.current?.setFieldsValue(data.params[data.target]); + form.setFieldsValue(data.params[data.target]); } else { setCloudScriptType("local"); - formRef.current?.setFieldsValue(defaultParams(script)); + form.setFieldsValue(defaultParams(script)); } }); } @@ -103,8 +103,7 @@ const CloudScriptPlan: React.FC<{ onConfirm={async () => { // 保存并导出 const dao = new ExportDAO(); - const params = - formRef.current?.getFieldsValue() as unknown as ExportParams; + const params = form.getFieldsValue() as unknown as ExportParams; if (!params || !script) { return; } @@ -162,7 +161,7 @@ const CloudScriptPlan: React.FC<{ width: "100%", }} layout="vertical" - ref={formRef} + form={form} >