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

vue3框架使用@antv/x6-vue-shape注册自定义节点,addNode报不存在的错误 #4209

Closed
yangboyu-934924296 opened this issue Feb 21, 2024 · 2 comments

Comments

@yangboyu-934924296
Copy link

问题描述

<script setup> import { Graph } from '@antv/x6'; import { ref, onMounted } from 'vue' import Count from '@/components/ProgressNode.vue' import { register } from '@antv/x6-vue-shape' register({ shape: 'custom-vue-node', width: 100, height: 100, component: Count, }) let graph = ref(null) onMounted(() => { graph.value = new Graph({ container: document.getElementById('container'), }) graph.value.addNode({ shape: 'custom-vue-node', x: 60, y: 100, }) }) </script>

//ProgressNode.vue

<script setup> import { ref } from 'vue' const count = ref(0) </script> You clicked me {{ count }} times. 版本 "@antv/x6": "^2.18.1", "@antv/x6-vue-shape": "^2.1.1", "vue": "^3.4.19"

重现链接

StackBlitz

重现步骤

<script setup> import { Graph } from '@antv/x6'; import { ref, onMounted } from 'vue' import Count from '@/components/ProgressNode.vue' import { register } from '@antv/x6-vue-shape' register({ shape: 'custom-vue-node', width: 100, height: 100, component: Count, }) let graph = ref(null) onMounted(() => { graph.value = new Graph({ container: document.getElementById('container'), }) graph.value.addNode({ shape: 'custom-vue-node', x: 60, y: 100, }) }) </script> <style lang="scss" scoped> #container { width: 100%; height: 100%; } </style>

//ProgressNode.vue

<script setup> import { ref } from 'vue' const count = ref(0) </script> You clicked me {{ count }} times.

预期行为

正常显示vue节点

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox ...]
  • X6 版本: [2.11.1 ...]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@yangboyu-934924296
Copy link
Author

vite版本问题导致的。
{
"name": "vite-vue-starter",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@antv/x6": "^2.18.1",
"@antv/x6-vue-shape": "^2.1.2",
"vue": "^3.4.19"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"vite": "^5.1.4"
}
}

@x6-bot
Copy link
Contributor

x6-bot bot commented Feb 21, 2025

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Feb 21, 2025
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

1 participant