by antfu
构建 Vue 应用程序需要在组件之间实现可预测的状态管理。Pinia 提供了一个类型安全、直观的 API,用于定义具有状态、getter 和 action 的存储库。本技能提供了构建可扩展 Vue 状态管理模式的全面参考。
1. 打开 Claude 聊天界面
2. 点击下方 "📋 复制" 按钮
3. 粘贴到 Claude 聊天框中并发送
4. 输入 "使用 pinia 技能" 开始使用
=== pinia 技能 === 作者: antfu 描述: 构建 Vue 应用程序需要在组件之间实现可预测的状态管理。Pinia 提供了一个类型安全、直观的 API,用于定义具有状态、getter 和 action 的存储库。本技能提供了构建可扩展 Vue 状态管理模式的全面参考。 使用方法: 1. 调用技能: "使用 pinia 技能" 2. 提供相关信息: 根据技能要求提供必要参数 3. 查看结果: 技能会返回处理结果 示例: "使用 pinia 技能,帮我分析一下这段代码"
这种方法适用于所有 Claude 用户,不需要安装额外工具。
coding
safe
Pinia is the official state management library for Vue, designed to be intuitive and type-safe. It supports both Options API and Composition API styles, with first-class TypeScript support and devtools integration.
The skill is based on Pinia v3.0.4, generated at 2026-01-28.
| Topic | Description | Reference |
|---|---|---|
| Stores | Defining stores, state, getters, actions, storeToRefs, subscriptions | core-stores |
| Topic | Description | Reference |
|---|---|---|
| Plugins | Extend stores with custom properties, state, and behavior | features-plugins |
| Topic | Description | Reference |
|---|---|---|
| Composables | Using Vue composables within stores (VueUse, etc.) | features-composables |
| Composing Stores | Store-to-store communication, avoiding circular dependencies | features-composing-stores |
| Topic | Description | Reference |
|---|---|---|
| Testing | Unit testing with @pinia/testing, mocking, stubbing | best-practices-testing |
| Outside Components | Using stores in navigation guards, plugins, middlewares | best-practices-outside-component |
| Topic | Description | Reference |
|---|---|---|
| SSR | Server-side rendering, state hydration | advanced-ssr |
| Nuxt | Nuxt integration, auto-imports, SSR best practices | advanced-nuxt |
| HMR | Hot module replacement for development | advanced-hmr |
storeToRefs() when destructuring state/getters to preserve reactivity@pinia/testing for component tests with mocked storesView Count
0
Download Count
0
Favorite Count
0
Quality Score
73