This commit is contained in:
zhutianqi
2021-11-08 14:09:55 +08:00
parent 3c35c536e7
commit 211e45e4eb
5 changed files with 71 additions and 42 deletions
@@ -50,6 +50,11 @@
})
},
handleNodeClick (node) {
let json = {
id: '123',
name: '123',
}
},
handleEdgeClick (node) {},
renderGraph(row) {
@@ -182,11 +187,8 @@
{
type: 'collapse-expand',
onChange: function onChange(item, collapsed) {
console.log(1);
const data = item.get('model');
const icon = item.get('group').find((element) => element.get('name') === 'collapse-icon');
console.log(data);
console.log(icon);
if (collapsed) {
icon.attr('symbol', G6.Marker.expand);
} else {
@@ -197,7 +199,7 @@
},
shouldBegin: (e) => {
const target = e.target
const nodeType = target.cfg.nature
const nodeType = target.cfg.name
if (nodeType === 'collapse-icon') return true;
return false;
}
@@ -77,7 +77,9 @@
// }
// this.$message.success('节点被点击' + data.name)
},
handleEdgeClick (node) {},
handleEdgeClick (node) {
console.log(4);
},
renderGraph() {
G6.registerNode(
'tree-node',
@@ -281,6 +283,7 @@
},
handleGraphDraw () {},
handleGraphNodeClickEvent(graph) {
console.log(1);
// 点击节点
graph.on('node:click', (e) => {
// 先将所有当前是 click 状态的节点置为非 click 状态
@@ -294,6 +297,7 @@
});
},
handleGraphEdgeClickEvent(graph) {
console.log(2);
// 点击边
graph.on('edge:click', (e) => {
// 先将所有当前是 click 状态的边置为非 click 状态