#
Junjie
2024-06-16 2a7b97eddbe3d24a47389a58dde46fe6175b6971
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React, { useEffect, useRef, useState } from "react";
import { Graph, Shape } from "@antv/x6";
import { GraphComponent } from "../../components/Flow/GraphComponent";
import { GraphTools } from "../../components/Flow/GraphTools";
import { RightMenu } from "../../components/Flow/RightMenu";
import { GraphDrawer } from "../../components/Flow/GraphDrawer";
import './index.less';
 
export default function () {
    const graphRef = useRef(null);
    const [ready, setReady] = useState(false);
 
    const initHandle = () => {
        setReady(true);
    }
 
    useEffect(() => {
        if (ready) {
            // 你需要在loading状态改变后执行的代码
            console.log('graphRef is ready:', graphRef.current);
        }
    }, [ready]);
 
    return (
        <div className="stencil-app">
            <GraphTools isReady={ready} graphRef={graphRef} />
            <GraphComponent ref={graphRef} initHandle={initHandle} />
            <RightMenu isReady={ready} graphRef={graphRef} />
            <GraphDrawer isReady={ready} graphRef={graphRef} />
        </div>
    );
}