1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| import React, { useRef, useEffect, useState } from "react";
| import { Button } from 'antd';
|
| export const GraphTools = ({ graphRef, isReady }) => {
|
| const exportData = () => {
| const graph = graphRef.current;
| if (isReady) {
| const data = graph.toJSON();
| console.log(data);
| // 这里你可以将数据发送到服务器或保存到本地
| }
| }
|
| return (
| <>
| <Button type="primary" onClick={exportData}>
| 导出数据
| </Button>
| </>
| );
| }
|
|