Vue tips · 132 tips

Vue & Nuxt tips

Over the last few years, I've collected a list of valuable tips while developing and writing about Vue & Nuxt. Some are clever, some I use almost every day, and some are more advanced — but they're all useful.

Vue Tip: Don't Use v-if With v-for Image

Vue Tip: Don't Use v-if With v-for

It can be tempting to combine v-if with v-for but you should avoid it as it will throw an error.
Vue Tip: Detect Mouse Hover Image

Vue Tip: Detect Mouse Hover

You can use Vue event handlers to detect mouse hover events.
Nuxt Tip: Add Custom iframe Tab to Nuxt DevTools Image

Nuxt Tip: Add Custom iframe Tab to Nuxt DevTools

Nuxt DevTools is designed to be extensible. You can add your own modules' integration to the DevTools.
Vue Tip: Debug Watcher Image

Vue Tip: Debug Watcher

You can debug watchers by passing a third options object with onTrack and onTrigger callbacks.
Nuxt Tip: Move Homepage to Sub-Folder in Nuxt 3 Image

Nuxt Tip: Move Homepage to Sub-Folder in Nuxt 3

Use the path property in the page's definePageMeta to move the homepage to a sub-folder in Nuxt 3.
Vue Tip: Chaining Event Modifiers Image

Vue Tip: Chaining Event Modifiers

By chaining multiple event modifiers together, you can create sophisticated event handling scenarios with ease.
Vue Tip: Effortless Handle Asynchronous Components With Suspense Image

Vue Tip: Effortless Handle Asynchronous Components With Suspense

Suspense components are used to display fallback content when waiting for some sort of asynchronous component to resolve.
Nuxt Tip: Use Nuxt Layers to Share Components, Utils, and Configuration Between Your Apps Image

Nuxt Tip: Use Nuxt Layers to Share Components, Utils, and Configuration Between Your Apps

One of the core features of Nuxt 3 is the layers and extending support. You can extend a default Nuxt application to reuse components, utils, and configuration.
Vue Tip: Declare and Mutate v-model Props as Normal Variable Using defineModel Image

Vue Tip: Declare and Mutate v-model Props as Normal Variable Using defineModel

Declaring and mutate v-model props as the same as normal variable using the defineModel.
Vue Tip: Optimize Performance Using shallowRef Image

Vue Tip: Optimize Performance Using shallowRef

shallowRef() is typically used for performance optimizations of large data structures, or integration with external state management systems.