vue

Reference Vue 3 Composition API, script setup macros, and reactivity patterns.

1|Updated Jul 13, 2024
One-click install
npx skills add https://github.com/fabio21777/vue-prime-base --skill vue-fabio21777
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vue
Source: https://github.com/fabio21777/vue-prime-base/tree/main/apps/ssr/.agents/skills/vue
Command: npx skills add https://github.com/fabio21777/vue-prime-base --skill vue-fabio21777

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Vue 3 introduces a steep learning curve around the Composition API, script setup macros, and reactivity, and this Skill provides a clear reference to accelerate effective usage in real projects.

Core Features & Use Cases

  • Script Setup & Macros: <script setup>, defineProps, defineEmits, defineModel, defineExpose, defineSlots, generics for concise component code.
  • Reactivity & Lifecycle: ref, shallowRef, computed, watch, watchEffect, effectScope, and common lifecycle hooks for robust state management.
  • Built-in Components & Directives: Transition, Teleport, Suspense, KeepAlive, v-memo, and custom directives guidance for rich UI patterns.
  • Use Case: Use Vue 3 SFCs with script setup to implement a reactive component with prop validation and emitted events.

Quick Start

Create a simple Vue 3 component using script setup, defineProps, and defineEmits to see reactive data flow in a template.

Frequently Asked Questions about vue

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use Vue 3 script setup macros like defineProps and defineEmits in an SFC?

Vue 3 script setup macros like defineProps and defineEmits enable concise component code by automatically exposing reactive properties and events. You declare them directly inside the script setup block to achieve reactive data flow without boilerplate.

When do I need built-in components like Transition, Teleport, and Suspense in Vue 3?

You need built-in components like Transition, Teleport, and Suspense in Vue 3 when building rich UI patterns. They manage element animations, portal content outside the DOM hierarchy, and coordinate async component loading states respectively.

What is the best way to manage Vue 3 reactivity and lifecycle hooks for robust state management?

The best way to manage Vue 3 reactivity and lifecycle hooks involves using ref, shallowRef, computed, and watchEffect. These functions track dependencies automatically, ensuring robust state management across common lifecycle stages.

Does Vue 3 defineModel work with custom directives and KeepAlive for component state preservation?

Vue 3 defineModel handles two-way binding and works alongside KeepAlive for component state preservation. Custom directives can be applied within the same SFC to create rich UI patterns without conflicting with the model macro.

Why does my Vue 3 watchEffect not trigger correctly when using shallowRef in script setup?

Vue 3 watchEffect might not trigger with shallowRef because shallowRef only tracks the .value replacement, not deep mutations. You must reassign the entire value or switch to a standard ref to achieve comprehensive reactive dependency tracking.