antvis / antvis/G6

[Bug]: 在Vue3中使用最新版antv/g6 5.0.50版,使用自定义节点Node,设置连接桩时,桩的位置不对

Open
#7,547 3 comments 0 reactions 0 assignees View on GitHub
bug 🐛
Dominant language
TypeScript
Stars
12.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug / 问题描述

```vue

import { ExtensionCategory, register, Graph } from '@antv/g6';
import { VueNode } from 'g6-extension-vue';
import { defineComponent, h } from 'vue';

export default {
name: 'G6VueWithPorts',
mounted() {
// Register Vue Node Type
register(ExtensionCategory.NODE, 'vue-node', VueNode);

// Define Vue Component with Ports
const MyVueNode = defineComponent({
props: ['nodeData'],
setup(props) {
return () => {
return h('div', {
style: {
padding: '12px 16px',
backgroundColor: '#FFFFFF',
border: '2px solid #1890FF',
borderRadius: '6px',
color: '#333',
textAlign: 'center',
minWidth: '120px',
boxShadow: '0 2px 6px rgba(0,0,0,0.1)'
}
}, `节点: ${props.nodeData.id}`);
};
},
});

// Create Graph with Port Configuration
const graph = new Graph({
container: 'container',
width: 800,
height: 600,
autoFit: 'center',
data: {
nodes: [
{ id: 'node1', style: { x: 200, y: 150 } },
{ id: 'node2', style: { x: 400, y: 250 } },
{ id: 'node3', style: { x: 300, y: 400 } },
],
edges: [
{ source: 'node1', target: 'node2' },
{ source: 'node2', target: 'node3' },
],
},
node: {
type: 'vue-node',
style: {
component: (data) => h(MyVueNode, { nodeData: data }),
ports: [
{
key: 'input',
placement: 'left',
fill: '#52C41A', // Green input port
r: 5,
},
{
key: 'output',
placement: 'right',
fill: '#FF4D4F', // Red output port
r: 5,
},
],
portStroke: '#fff',
portLineWidth: 2,
},
},
edge: {
style: {
endArrow: true,
stroke: '#1890FF',
},
},
});

// Render the graph
graph.render();
}
};

#container {
width: 100%;
height: 100vh;
}

Image
连接桩位置不在节点两侧

### Reproduction link / 复现链接

_No response_

### Steps to Reproduce the Bug or Issue / 重现步骤

_No response_

### Version / 版本

🆕 5.x

### OS / 操作系统

- [ ] macOS
- [ ] Windows
- [ ] Linux
- [ ] Others / 其他

### Browser / 浏览器

- [ ] Chrome
- [ ] Edge
- [ ] Firefox
- [ ] Safari (Limited support / 有限支持)
- [ ] IE (Nonsupport / 不支持)
- [ ] Others / 其他

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the VueNode registration and Graph node style shown in the report, especially port placement during graph.render(). Reproduce the Vue 3 example with G6 5.0.50 and verify that the input and output ports appear on the node's left and right sides; the issue is done when their positions are correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.