- Handle graph click

This commit is contained in:
Tuan Cao 2022-04-18 15:06:10 +07:00
parent 758a8c90b4
commit 1089489672

View File

@ -51,7 +51,7 @@ const styleSheet = [{
'line-color': '#9a9a9a', 'line-color': '#9a9a9a',
'target-arrow-color': '#ccc', 'target-arrow-color': '#ccc',
// 'target-arrow-shape': 'triangle', // 'target-arrow-shape': 'triangle',
'curve-style': 'bezier' 'curve-style': 'straight'
} }
}]; }];
@ -94,11 +94,12 @@ function Graph({graph}) {
cy.on("tap", "node", evt => { cy.on("tap", "node", evt => {
var node = evt.target; var node = evt.target;
console.log("EVT", evt); let nodeData = node.data();
console.log("TARGET", node.data()); if (typeof nodeData.id === 'string') {
console.log("TARGET TYPE", typeof node[0]); const routerPath = '/note/' + node.data().id
router.push(routerPath)
}
}); });
}} }}
/> />
</div> </div>