Category · 59 articles

Script

Articles in the category Script.

Vue Tip: Document Your Component Props Using JSDoc Image

Vue Tip: Document Your Component Props Using JSDoc

You can use JSDoc to document your component props so that they show up when you hover over the component in your IDE.
Vue Tip: Composable to Define Keyboard Shortcuts Image

Vue Tip: Composable to Define Keyboard Shortcuts

I show you a handy Vue composable that allows you to define keyboard shortcuts in your app.
Vue Tip: Use a Head Manager Image

Vue Tip: Use a Head Manager

Unhead is a framework-agnostic document head manager that can be used to manage page metadata like the title in your Vue application.
Vue Tip: Automatically Import Components Image

Vue Tip: Automatically Import Components

Use the unplugin-vue-components tool to automatically import your Vue components.
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.js application, enabling you to manipulate and interact with specific elements in the child component's template from the parent component.
Vue Tip: Event Handling Image

Vue Tip: Event Handling

There are different ways how to handle events in Vue. Let's take a look at them.
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>. Otherwise Vue will not be able to determine the current active component instance and cannot correctly register features like lifecycle hooks, watchers, and computed properties.
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. To trigger the watcher on mutation, the deep option must be specified.
Vue Tip: Simple State Management With Composition API Image

Vue Tip: Simple State Management With Composition API

Learn how you can use Composition API for a simple state management solution which you can use instead of Pinia.
Vue Tip: Manually Stop Watcher Image

Vue Tip: Manually Stop Watcher

You need to manually stop your Vue watcher if they are created asynchronously. Sync watchers are automatically stopped when the component is unmounted.