Skip to content

Commit cdd74d9

Browse files
committed
调整引入方式
1 parent 7fffa68 commit cdd74d9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/graph/graph.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ function findError(graphData: FunctionPlotDatum[]) {
5656
5757
let unwatchHandler: WatchHandle | null = null;
5858
const emit = defineEmits(["require-post-update"]);
59-
onMounted(async () => {
60-
const functionPlot = (await import("function-plot")).default;
59+
import functionPlot from "function-plot";
60+
onMounted(() => {
6161
const handleUpdate = throttle(() => {
6262
if (import.meta.env.DEV) console.log("graph update");
6363
const graphData = profile.getOriginalData();
@@ -67,15 +67,15 @@ onMounted(async () => {
6767
return;
6868
}
6969
try {
70-
plotRef.value &&
71-
functionPlot({
72-
target: plotRef.value,
73-
data: <FunctionPlotDatum[]>graphData,
74-
width: width - 20,
75-
height: height - 20,
76-
annotations: profile.getOriginalAnnotaion(),
77-
...profile.getOriginalOptions(),
78-
});
70+
if (!plotRef.value) throw new Error("plotRef is null");
71+
functionPlot({
72+
target: plotRef.value,
73+
data: graphData,
74+
width: width - 20,
75+
height: height - 20,
76+
annotations: profile.getOriginalAnnotaion(),
77+
...profile.getOriginalOptions(),
78+
});
7979
if (fullUpdateState.value) {
8080
fullUpdateState.value = false;
8181
emit("require-post-update", "once after error");

0 commit comments

Comments
 (0)