简体   繁体   English

Next.js 是否具有与 Nuxt.js 相同的自动注册功能?

[英]Does Next.js have equivalent auto-register feature like Nuxt.js?

Background story (you can skip to question)背景故事(你可以跳到问题)

As a begginer (full-stack, but about 8 years behind) I'm struggling with deciding what to learn.作为一个初学者(全栈,但落后了大约 8 年),我正在努力决定要学什么。

Vue and Nuxt.js are great to understand, but as a designer, I really miss the option to use Framer Motion. VueNuxt.js很好理解,但作为设计师,我真的很怀念使用Framer Motion 的选项。 Also the fact that I can't use Tailwind UI (Headless UI) with Nuxt (as of right now) since Nuxt still uses Vue 2.此外,由于 Nuxt 仍然使用Vue 2 ,我无法将Tailwind UI (无头 UI)与Nuxt一起使用(截至目前)。

As I worked on my app I felt that I would have much better online support with React, specifically with Next.js to make the learning curve easier.当我在我的应用程序上工作时,我觉得我会使用 React 获得更好的在线支持,特别是使用Next.js来简化学习曲线。 The overall community is bigger and there are much more tutorials.整个社区更大,教程也更多。 But I discovered that Nuxt used some things that Next is missing (probably?) — like auto registering components.但我发现 Nuxt 使用了 Next 缺少的一些东西(可能?)——比如自动注册组件。


The question:问题:

I really miss not caring about writing an import path to each component I use.我真的很怀念不关心为我使用的每个组件编写导入路径 Nuxt.js did this automatically . Nuxt.js自动执行此操作。 Is there something similar in Nuxt.js? Nuxt.js 中是否有类似的东西?

I could also nest them in subfolders like this:我也可以将它们嵌套在这样的子文件夹中:

/components/Point/Section/Table/Row.vue

and put them in code like: <PointSectionTableRow />并将它们放在如下代码中: <PointSectionTableRow />

Thanks Estus for the comment that IDE's handle autoimport.感谢Estus对 IDE 处理自动导入的评论。 I discovered VS Code Auto import plugin that can autoimport components, icons etc with just a tooltip click.我发现了VS Code 自动导入插件,只需单击工具提示即可自动导入组件、图标等。 Very handy!非常便利!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM