Skip to content

自定义工具Button的引入问题 #4600

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

Open
Makaite opened this issue Apr 2, 2025 · 2 comments
Open

自定义工具Button的引入问题 #4600

Makaite opened this issue Apr 2, 2025 · 2 comments
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions

Comments

@Makaite
Copy link

Makaite commented Apr 2, 2025

问题描述

按照文档的示例,在vue3中引入Button以后会直接报错chunk-Y5IMUDA4.js?v=e46cf4d7:220 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'ToolItem'),这个时候只是引入,如果把引入的内容删除掉还是会报错,但是我从新从git仓库把我的代码拉去下来运行是正常的

代码示例:
import { Button } from '@antv/x6/es/registry/tool/button';
报错示例:
chunk-Y5IMUDA4.js?v=e46cf4d7:220 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'ToolItem')

重现链接

没有重现连接可以提供使用

重现步骤

1、引入Button,
示例:import { Button } from '@antv/x6/es/registry/tool/button';
2、保存运行这个vue3项目
3、报错:
chunk-Y5IMUDA4.js?v=e46cf4d7:220 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'ToolItem')

预期行为

Button的正常引入

平台

  • 操作系统: Windows
  • 网页浏览器:Google Chrome
  • X6 版本: [2.18.1]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@NewByVector
Copy link
Contributor

参考这个 vitejs/vite#3413 可以解决。

@NewByVector NewByVector added the type: discussion 讨论 Usage questions, guidance, and other discussions label Apr 2, 2025
@Makaite
Copy link
Author

Makaite commented Apr 7, 2025

参考这个 vitejs/vite#3413 可以解决。
按照您给的连接,问题解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions
Projects
None yet
Development

No branches or pull requests

2 participants