Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

g6 3.0.4版本 事件监听无法监听到节点 #121

Open
lQei opened this issue Jun 21, 2019 · 2 comments
Open

g6 3.0.4版本 事件监听无法监听到节点 #121

lQei opened this issue Jun 21, 2019 · 2 comments

Comments

@lQei
Copy link

lQei commented Jun 21, 2019

在click事件中item为空
node:click事件无法监听到

this.graphData = {
nodes: [{
id: 'node1',
shape:'circle',
label: 'START',
x: 100,
y: 100,
labelCfg:{

		    }
		 },{
		    id: 'node2',
		    shape:'rect',
		    x: 100,
		    y: 200
		 },{
			 	id: 'node3',
			 	shape:'rect',
		    x: 200,
		    y: 200
		  },{
		  	id: 'node4',
		  	shape:'circle',
		  	label: 'END',
		  	size: 60,
		    x: 100,
		    y: 300,
		    style: {
		      lineWidth: 2
		    }
		  }],
		  edges: [
		  	{source: 'node1',target: 'node2'},
		  	{source: 'node2',target: 'node3'},
		  	{source: 'node2',target: 'node4'}
		  ]
		};
		var graph = new G6.Graph({
		  container: 'mountNode',
		  width: 500,
		  height: 500
		});
		graph.read(this.graphData);
		graph.on('node:click', ev => {
			console.log('node:click',ev)
			//that.clickGraphItem(ev)
		});
		graph.on('click', ev => {
			console.log('click',ev,ev.item)
		  const shape = ev.target;
		  const node = ev.item;
		  if(node){
		  	this.clickGraphItem(node)
		  }
		});
@guozhaolong
Copy link

我是3.0.4,可以监听到,代码看上去没问题,不行你删了包重新得一下

@lQei
Copy link
Author

lQei commented Jun 24, 2019 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants