relation-graph
relation-graph copied to clipboard
无法获取组件实例
<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文件的数据的时候可以,我从数据库查询的数据好像不行
似乎那个时候还没渲染
已解决,使用Json序列化 const __graph_json_data: RGJsonData = JSON.parse(JSON.stringify(rdata.value));