Calling auto-imported composables/utils in templates — allowed or anti-pattern? #33564
Replies: 1 comment
-
|
I would say that as with the auto-imports in general - it is up to you and your personal preference. It is designed to work like this and I personally like it and use it. Some other ppl would prefer to have explicit imports and then they would also "wrap" them in variables instead of calling them directly. Sometimes it may be useful to do something like Generally it is a good practice to keep the template expressions simple to have them clean and easy to read. Single method call is ok (for me better than creating a variable just for sake of having a variable - which possibly introduce the whole |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Can composables and utils be called directly inside the template, or should they always be invoked in
<script setup>?Docs reference: Nuxt Auto-Imports Guide
The docs show examples using composables in
setupbut give no hint about calling them directly in the template.❓ Examples
Beta Was this translation helpful? Give feedback.
All reactions