如何在NUXT 3项目中使用troisjs

发布于 2025-02-13 02:39:48 字数 500 浏览 0 评论 0原文

我想将troisjs vue for Vue)与nuxt.js一起使用。根据troisjs文档( https://troisjs.github.io/guide/install.html#existing-vuejs-3-project )我需要将其添加到我的项目中:

import { TroisJSVuePlugin } from 'troisjs';
app.use(TroisJSVuePlugin);

但是,我不知道如何知道如何知道找出我应该放这个代码的地方

troisjs而不是三。 介意使用它。

不要

I would like to use TroisJS (three.js wrapper for Vue) with Nuxt.js. According to the TroisJS documentation (https://troisjs.github.io/guide/install.html#existing-vuejs-3-project) I need to add it to my project like:

import { TroisJSVuePlugin } from 'troisjs';
app.use(TroisJSVuePlugin);

However, I don"t know how to figure out where I should put this code. I would expect the nuxt.config.js file, but I don't seem to quite get it where it should go.

I decided to use TroisJS and not three.js because I thought the former might be easier to import and use. If importing three.js directly is easier, I don't mind using it.

Thank you very much for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

飞烟轻若梦 2025-02-20 02:39:48

/plugins文件夹中添加新文件,名为troisjs-plugin.js带有以下内容:

import { TroisJSVuePlugin } from 'troisjs';

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(TroisJSVuePlugin )
})

In /plugins folder add new file named troisjs-plugin.js with the following content :

import { TroisJSVuePlugin } from 'troisjs';

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(TroisJSVuePlugin )
})

煮酒 2025-02-20 02:39:48

我找到了一个与TROIS和NUXT 3进行测试的回购,可能已经过时了,也许有些API已更改,但是如果您想检查一下: alvarosabu/nuxt3-trois

另外,Trois作者还有一个官方回购,其中有一个NUXT 3自定义插件(也可能已经过时)在这里 a>

I found a repo with some testing with Trois and Nuxt 3, probably outdated and maybe some apis have changed, but if you wanna check it out: alvarosabu/nuxt3-trois

Also, there's an official repo from the Trois author with a Nuxt 3 custom plugin (probably outdated too) here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文