选项
首页首页 Skill 网页开发 vue-pinia-best-practices

vue-pinia-best-practices

vuejs-ai/skills vuejs-ai/skills

了解 Vue 应用程序中 Pinia 的最佳实践、常见陷阱以及状态管理模式。

...展开全部
2
更新时间 2026-09-28

Pinia 的最佳实践、常见陷阱及状态管理模式。

存储配置

  • 启动时出现“getActivePinia 已被调用”错误 → 参见 pinia-no-active-pinia-error
  • 在 DevTools 或 SSR 中设置存储时状态缺失 → 参见 pinia-setup-store-return-all-state

响应式

  • Store解构导致 UI 无法响应式更新 → 参见 pinia-store-destructuring-breaks-reactivity
  • 在模板调用中,Store 方法会丢失上下文 → 参见 store-method-binding-parentheses

状态模式

  • 过滤器在刷新时会被重置或无法共享 → 参见 state-url-for-ephemeral-filters
  • 在不使用 DevTools 或约定情况下构建生产级应用 → 参见 state-use-pinia-for-large-apps
在 GitHub 上查看
---
name: vue-pinia-best-practices
description: Learn Pinia best practices, common gotchas, and state management patterns for Vue applications.
license: MIT
---

Pinia best practices, common gotchas, and state management patterns.

### Store Setup
- Getting "getActivePinia was called" error at startup → See [pinia-no-active-pinia-error](reference/pinia-no-active-pinia-error.md)
- Setup stores missing state in DevTools or SSR → See [pinia-setup-store-return-all-state](reference/pinia-setup-store-return-all-state.md)

### Reactivity
- Store destructuring stops updating UI reactively → See [pinia-store-destructuring-breaks-reactivity](reference/pinia-store-destructuring-breaks-reactivity.md)
- Store methods lose context in template calls → See [store-method-binding-parentheses](reference/store-method-binding-parentheses.md)

### State Patterns
- Filters reset on refresh or can't be shared → See [state-url-for-ephemeral-filters](reference/state-url-for-ephemeral-filters.md)
- Building production app without DevTools or conventions → See [state-use-pinia-for-large-apps](reference/state-use-pinia-for-large-apps.md)

安装 vue-pinia-best-practices

下载技能文件并将其解压到 .claude/skills/ 目录中。

下载ZIP

克隆仓库并复制技能文件到您的项目中。

git clone https://github.com/vuejs-ai/skills/tree/main/skills/vue-pinia-best-practices # Copy SKILL.md to your .claude/skills/ directory

复制 复制
快速设置: 将技能文件夹复制到 .claude/skills/ Claude 会自动检测并使用该技能

相关技能

github-code-search
更新时间 2026-06-29
drizzle-orm
更新时间 2026-06-29
prisma-client-api
更新时间 2026-06-29
clickhouse-io
更新时间 2026-06-29
OR