Vue Tip: Use Eager Computed Without Lazy Evaluation
Computed properties are evaluated lazily which means they are only evaluated when they are accessed. The computedEager() from VueUse is a good alternative for simple operations.
Vue tips · 132 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.
Computed properties are evaluated lazily which means they are only evaluated when they are accessed. The computedEager() from VueUse is a good alternative for simple operations.
Learn how you can dynamically import components in Nuxt 3 only when they’re needed.
It can be tempting to combine v-if with v-for but you should avoid it as it will throw an error.
You can use Vue event handlers to detect mouse hover events.
Nuxt DevTools is designed to be extensible. You can add your own modules' integration to the DevTools.
You can debug watchers by passing a third options object with onTrack and onTrigger callbacks.
Use the path property in the page's definePageMeta to move the homepage to a sub-folder in Nuxt 3.
By chaining multiple event modifiers together, you can create sophisticated event handling scenarios with ease.
Suspense components are used to display fallback content when waiting for some sort of asynchronous component to resolve.
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.
Declaring and mutate v-model props as the same as normal variable using the defineModel.
shallowRef() is typically used for performance optimizations of large data structures, or integration with external state management systems.
By default, Nuxt uses universal (client-side + server-side) rendering to render your application. The ClientOnly component can be used torender its slot only in client-side.
You can validate prop types and events in Vue. If a requirement is not met, Vue will warn you in the browser's JavaScript console.
Nuxt 3's useAsyncData() composable can be used within your pages, components, and plugins to get access to data that resolves asynchronously. It can also be used to refresh the data loaded from the API based on the user's action. (pagination, filtering results, searching, etc.)
When should I use a render function in Vue.js? We’re going to cover some advanced Vue.js patterns when you need to use render functions.
Nuxt 3 provides plenty of options for rendering. There are SSG, SSR, Universal, SPA, ISG, or mix it up per route with hybrid rendering.
Guide to debug Vue component templates using the Browser DevTools.
A Scoped Slot in a child component can provide data for presentation in the parent component using a slot.
Nuxt DevTools is a set of visual tools that help you to know your app better.
In SPA that uses the Vue Router, it’s common to create a path parameter that changes the behavior of a route.
How to correctly destructure props object in a Vue component while maintaining the reactivity.
Nuxi analyze is an experimental feature that builds your Nuxt app and analyses the production bundle.
Besides Option Stores you can also use Setup Stores to define stores in Pinia. They bring more flexibility as you can create watchers within a store and freely use any composable.