Skip to content

Commit c4e14fa

Browse files
committed
优化导入动画
1 parent 7f0c088 commit c4e14fa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/editor/import.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,13 @@ function handleImport() {
6060
try {
6161
const parsed = JSON5.parse(importStr.value);
6262
if (typeof parsed !== "object" || parsed === null) throw null;
63-
if(typeof parsed.data !== "object" || !Array.isArray(parsed.data)) throw null;
64-
profile.data = toInternalDatum(
63+
if (typeof parsed.data !== "object" || !Array.isArray(parsed.data))
64+
throw null;
65+
const newData = toInternalDatum(
6566
(JSON5.parse(importStr.value).data as FunctionPlotDatum[]) ?? []
6667
);
68+
profile.data = [];
69+
profile.data = newData;
6770
Snackbar.builder({
6871
text: t("title.importSuccess"),
6972
type: "success",

0 commit comments

Comments
 (0)