NUXT 3本地JS包含
用NUXT 3跑入墙壁,包括本地JS文件。我将HTML模板转换为主布局和几个组件。还在主题为全球的CSS中添加。最后一部分是包括以下从主题提供的本地JS文件:
custom.js,bootstrap.min.js和slider.js
我尝试将它们添加到nuxt.config .TS
在HEAD元素中,作为插件以及布局组件中,但这些方法似乎都没有用。我似乎找不到NUXT 3的干净工作答案。
Running into a wall with Nuxt 3 and including local JS files. I converted an HTML template into a main Layout and several Components. Also added in the CSS supplied from the theme as global. The last part is to include the following local JS files supplied from the theme:
custom.js, bootstrap.min.js, and slider.js
I have tried adding them to the nuxt.config.ts
within the head element, as plugins, and within the layout Component as well, but none of these methods seem to work. I can't seem to find a clean working answer for Nuxt 3.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在NUXT3中,您可以添加组件中的全球资产。
例如,从您的主布局中。
如果您需要更多的脚本道具,请查看此接口:
您可以将
/public
目录用于文件,并使用相对修补程序附加它们。In nuxt3 you can add global assets from components.
For example from your main layout.
If you need more props for your script look at this interface:
You can use
/public
directory for your files and append them using relative patch.