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: Automatically Import Components Image

Vue Tip: Automatically Import Components

Use the unplugin-vue-components tool to automatically import your Vue components.
Pinia Tip: Simple History With Undo and Redo Functionality Image

Pinia Tip: Simple History With Undo and Redo Functionality

Build a simple history with undo and redo functionality using the useRefHistory composable from VueUse.
Vue Tip: Accessing Template Ref in Child Component Image

Vue Tip: Accessing Template Ref in Child Component

Learn how to access template refs in a child component within a Vue.
Nuxt Tip: How to Fix "Nuxt Instance Unavailable" Error Image

Nuxt Tip: How to Fix "Nuxt Instance Unavailable" Error

If you are using Nuxt 3, you probably already encountered the 'Nuxt Instance Unavailable' error.
Vue Tip: Dynamic Slot Names Image

Vue Tip: Dynamic Slot Names

Dynamic directive arguments also work on v-slot, allowing the definition of dynamic slot names.
Nuxt Tip: Detecting Server vs. Client-Side Code Execution Image

Nuxt Tip: Detecting Server vs. Client-Side Code Execution

Nuxt 3 provides a way to detect whether your code is running on the server or client-side.
Vue Tip: Event Handling Image

Vue Tip: Event Handling

There are different ways how to handle events in Vue.
Vue Tip: Use Your Composables Synchronously Image

Vue Tip: Use Your Composables Synchronously

You should always call your composables synchronously in setup() hook or <script setup>.
Nuxt Tip: Custom SPA Loading Template for Your Nuxt Application Image

Nuxt Tip: Custom SPA Loading Template for Your Nuxt Application

When using the client-side rendering mode, Nuxt will display a loading indicator until the application is hydrated.
Vue Tip: Deep Watch on Arrays Image

Vue Tip: Deep Watch on Arrays

In Vue 3, when using the watch option to watch an array, the callback will only trigger when the array is replaced.