relation-graph icon indicating copy to clipboard operation
relation-graph copied to clipboard

无法获取组件实例

Open Halecoder opened this issue 1 year ago • 2 comments

<RelationGraph ref="graphRef" :options="graphOptions">
const graphRef = ref<RelationGraphComponent>();
onMounted(() => {
  init();
  setGraphData();
});

const setGraphData = async () => {
  const __graph_json_data: RGJsonData = rdata.value;
  const graphInstance = graphRef.value!.getInstance();
  await graphInstance.setJsonData(__graph_json_data);
};

不知道怎们回事,使用json文件的数据的时候可以,我从数据库查询的数据好像不行 image

Halecoder avatar Jun 20 '24 08:06 Halecoder

似乎那个时候还没渲染

Halecoder avatar Jun 20 '24 08:06 Halecoder

已解决,使用Json序列化 const __graph_json_data: RGJsonData = JSON.parse(JSON.stringify(rdata.value));

Halecoder avatar Jun 20 '24 08:06 Halecoder