Skip to content

Commit dbdbec1

Browse files
committed
⚡️ 优化脚本储存数据过大导致的卡顿问题
1 parent dbd9ad4 commit dbdbec1

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/pages/components/ScriptStorage/index.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,15 @@ const ScriptStorage: React.FC<{
108108
case "string":
109109
return col;
110110
default:
111-
return JSON.stringify(col);
111+
return (
112+
<span
113+
style={{
114+
whiteSpace: "break-spaces",
115+
}}
116+
>
117+
{JSON.stringify(col, null, 2)}
118+
</span>
119+
);
112120
}
113121
},
114122
},
@@ -211,6 +219,7 @@ const ScriptStorage: React.FC<{
211219
key: value.key,
212220
value: value.value,
213221
createtime: Date.now(),
222+
updatetime: 0,
214223
},
215224
...data,
216225
]);
@@ -228,15 +237,18 @@ const ScriptStorage: React.FC<{
228237
value:
229238
typeof currentValue?.value === "string"
230239
? currentValue?.value
231-
: JSON.stringify(currentValue?.value),
240+
: JSON.stringify(currentValue?.value, null, 2),
232241
type: valueType(currentValue?.value || "string"),
233242
}}
234243
>
235244
<FormItem label="Key" field="key" rules={[{ required: true }]}>
236245
<Input placeholder="key" disabled={!!currentValue} />
237246
</FormItem>
238247
<FormItem label="Value" field="value" rules={[{ required: true }]}>
239-
<Input placeholder="当类型为object时,请输入可以JSON解析的数据" />
248+
<Input.TextArea
249+
rows={6}
250+
placeholder="当类型为object时,请输入可以JSON解析的数据"
251+
/>
240252
</FormItem>
241253
<FormItem label="类型" field="type" rules={[{ required: true }]}>
242254
<Select>

0 commit comments

Comments
 (0)