Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@antv/x6-vue-shape vue自定义节点获取不到参数 #4551

Closed
zhoufanglu opened this issue Jan 2, 2025 · 1 comment
Closed

@antv/x6-vue-shape vue自定义节点获取不到参数 #4551

zhoufanglu opened this issue Jan 2, 2025 · 1 comment

Comments

@zhoufanglu
Copy link

Describe the bug

vue自定义节点获取不到data参数

Your Example Website or App

Steps to Reproduce the Bug or Issue

创建节点

graph.addNode({
        id: nodeData.id,
        shape: "CatalogNode",
        width: flexWidth - 30,
        height: 40,
        x: 30,
        y: 50 + index * 60,
        data: {  // 这里是入参值
          test: "aa",
          id: nodeData.id,
          name: nodeData.name,
          tableCount: nodeData.tableCount,
          columnCount: nodeData.columnCount
        },
      });

自定义节点接收参数

接收不到。

<script setup lang="ts">
import { defineProps, PropType } from "vue";
const props = defineProps({
  data: {
    type: Object as PropType<{
      test: string;
      id: string | number;
      name: string;
      tableCount: number;
      columnCount: number;
    }>,
    required: true
  }
});
setTimeout(() => {
  console.log(23, props.data);  // 这里是undefind
}, 800);
</script>

Expected behavior

Screenshots or Videos

Platform

"@antv/layout": "^0.3.25",
"@antv/x6": "^2.18.1",
"@antv/x6-vue-shape": "^2.1.2",

Additional context

No response

@zhoufanglu
Copy link
Author

const getNode = inject("getNode") as Function;
// 当前node参数
const node = getNode();
const nodeData: NodeDataType = node.getData();

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

No branches or pull requests

1 participant