Skip to content
New issue

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

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

Already on GitHub? # to your account

An error was reported when binding three.js #326

Open
hyh6411 opened this issue Dec 7, 2024 · 2 comments
Open

An error was reported when binding three.js #326

hyh6411 opened this issue Dec 7, 2024 · 2 comments

Comments

@hyh6411
Copy link

hyh6411 commented Dec 7, 2024

image

When I used kekule in the vue2 project and ran
Kekule.externalResourceManager.register('three.js', THREE)
to bind three.js, an error was reported when running to
this.chemViewer.setRenderType(Kekule.Render.RendererType.R3D);
This error did not occur in html, but this problem occurred when I copied the code into vue2.

Also, the kekule installed using npm could not be used, so I used:
<script src="https://cdn.jsdelivr.net/npm/kekule/dist/kekule.min.js" exclude></script>

@partridgejiang
Copy link
Owner

能麻烦把整个文件的代码贴在这里么?three又是如何引入的,import还是直接用<script>标签?

@hyh6411
Copy link
Author

hyh6411 commented Dec 12, 2024

你好,我是使用npm i安装的kekule获取不到kekule对象,所以使用<script>引入kekule, three使用<script>标签会在加载js文件结束就报错,npm安装three后使用3D视图时报错:

this.chemViewer = new Kekule.ChemWidget.Viewer(document);
this.chemViewer.setRenderType(Kekule.Render.RendererType.R3D);

目前我使用别的办法已经解决了,使用<script>引入kekule, 使用npm 安装three, 并将代码调整为:

this.viewer3D = new Kekule.ChemWidget.Viewer3D(this.$refs.kekule3DViewerRef);
this.viewer3D.setChemObj(mol);

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

No branches or pull requests

2 participants